MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / DecomposeFromTo

Method DecomposeFromTo

Source/URLab/Private/MuJoCo/Utils/MjUtils.cpp:125–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123}
124
125bool MjUtils::DecomposeFromTo(const FXmlNode* Node,
126 FVector& OutPos, FQuat& OutQuat,
127 float& OutHalfLength)
128{
129 if (!Node)
130 return false;
131 const FString FromToStr = Node->GetAttribute(TEXT("fromto"));
132 if (FromToStr.IsEmpty())
133 return false;
134
135 FVector Start, End;
136 if (!ParseFromTo(FromToStr, Start, End))
137 return false;
138
139 OutPos = (Start + End) * 0.5f;
140
141 const FVector Dir = (End - Start).GetSafeNormal();
142 OutQuat = Dir.IsNearlyZero()
143 ? FQuat::Identity
144 : FQuat::FindBetweenNormals(FVector(0.f, 0.f, 1.f), Dir);
145
146 // UE cm -> MuJoCo m for the half-length.
147 OutHalfLength = (End - Start).Size() * 0.5f / 100.0f;
148 return true;
149}
150
151void MjUtils::DrawDebugGeom(UWorld* World, const mjModel* m, const GeomView& geom_view, const FColor& DrawColor, float Multiplier)
152{

Callers

nothing calls this directly

Calls 1

IsEmptyMethod · 0.80

Tested by

no test coverage detected