diff --git a/ShapeKernel/Frames/LocalFrame.cs b/ShapeKernel/Frames/LocalFrame.cs
index 8956a86..0739e65 100644
--- a/ShapeKernel/Frames/LocalFrame.cs
+++ b/ShapeKernel/Frames/LocalFrame.cs
@@ -202,6 +202,31 @@ public static LocalFrame oGetRotatedFrame(LocalFrame oFrame, float dPhi, Vector3
return oNewFrame;
}
+ ///
+ /// Returns a new LocalFrame positioned at an offset relative to the given reference frame.
+ /// The offset is interpreted in the reference frame's local coordinate system.
+ /// Use caution if chaining relative frames as inaccuracies can compound.
+ ///
+ /// The LocalFrame whose local axes define the translation directions
+ /// Translation vector in the reference frame's local coordinates
+ /// A new LocalFrame translated relative to the reference frame
+ public static LocalFrame oGetRelativeFrame(LocalFrame refFrame, Vector3 vecLocalOffset)
+ {
+ Vector3 vecRefX = refFrame.vecGetLocalX();
+ Vector3 vecRefY = refFrame.vecGetLocalY();
+ Vector3 vecRefZ = refFrame.vecGetLocalZ();
+
+ Vector3 vecGlobalOffset =
+ vecRefX * vecLocalOffset.X
+ vecRefY * vecLocalOffset.Y +
+ vecRefZ * vecLocalOffset.Z;
+
+ Vector3 vecNewPosition = refFrame.vecGetPosition() + vecGlobalOffset;
+
+ return new LocalFrame(vecNewPosition, refFrame.vecGetLocalZ(), refFrame.vecGetLocalX());
+ }
+
+
///
/// Compliments local z and local x according to a right-hand system.
///
@@ -212,4 +237,4 @@ public static Vector3 vecGetLocalY(Vector3 vecLocalZ, Vector3 vecLocalX)
}
}
}
-}
\ No newline at end of file
+}