MCPcopy Create free account
hub / github.com/PCGEx/PCGExtendedToolkit / Mutate

Method Mutate

Source/PCGExtendedToolkit/Private/Paths/PCGExPaths.cpp:644–669  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

642}
643
644void FPCGExSplineMeshMutationDetails::Mutate(const int32 PointIndex, PCGExPaths::FSplineMeshSegment& InSegment)
645{
646 if (!bPushStart && !bPushEnd) { return; }
647
648 const double Size = (bPushStart || bPushEnd) && (bRelativeStart || bRelativeEnd) ? FVector::Dist(InSegment.Params.StartPos, InSegment.Params.EndPos) : 1;
649 const FVector StartDir = InSegment.Params.StartTangent.GetSafeNormal();
650 const FVector EndDir = InSegment.Params.EndTangent.GetSafeNormal();
651
652 if (bPushStart)
653 {
654 const double Factor = StartAmount->Read(PointIndex);
655 const double Dist = bRelativeStart ? Size * Factor : Factor;
656
657 InSegment.Params.StartPos -= StartDir * Dist;
658 InSegment.Params.StartTangent = StartDir * (InSegment.Params.StartTangent.Size() + Dist * 3);
659 }
660
661 if (bPushEnd)
662 {
663 const double Factor = EndAmount->Read(PointIndex);
664 const double Dist = bRelativeEnd ? Size * Factor : Factor;
665
666 InSegment.Params.EndPos += EndDir * Dist;
667 InSegment.Params.EndTangent = EndDir * (InSegment.Params.EndTangent.Size() + Dist * 3);
668 }
669}
670
671#undef LOCTEXT_NAMESPACE
672#undef PCGEX_NAMESPACE

Callers 2

ProcessSinglePointMethod · 0.45
ProcessSinglePointMethod · 0.45

Calls 1

ReadMethod · 0.45

Tested by

no test coverage detected