public static LFTree Transform(LFTree t, Matrix4x4 matrix) { Matrix4x4 invert = matrix.inverse; LFTree x = LFTree.x, y = LFTree.y, z = LFTree.z; return(t.Remap( invert.m00 * x + invert.m01 * y + invert.m02 * z + invert.m03, invert.m10 * x + invert.m11 * y + invert.m12 * z + invert.m13, invert.m20 * x + invert.m21 * y + invert.m22 * z + invert.m23)); }
/// <summary>Clip the given shape at the z origin, /// and duplicate the remaining shape reflected /// on the other side of the origin</summary> public static LFTree SymmetricZ(this LFTree t) { return(t.Remap(LFTree.x, LFTree.y, Abs(LFTree.z))); }
/// <summary>Clip the given shape at the x origin, /// and duplicate the remaining shape reflected /// on the other side of the origin</summary> public static LFTree SymmetricX(this LFTree t) { return(t.Remap(Abs(LFTree.x), LFTree.y, LFTree.z)); }
/// <summary>Moves the given shape across the plane X=Z</summary> public static LFTree ReflectXZ(this LFTree t, float offset = 0f) { return(t.Remap(LFTree.z, LFTree.y, LFTree.x)); }
/// <summary>Reflect the given shape about the z origin or an optional offset"</summary> public static LFTree ReflectZ(this LFTree t, float offset = 0f) { return(t.Remap(LFTree.x, LFTree.y, (2f * offset) - LFTree.z)); }
//Reference: https://github.com/libfive/libfive/blob/master/libfive/bind/transforms.scm /// <summary>Translates this shape</summary> public static LFTree Move(LFTree t, Vector3 translation) { return(t.Remap(LFTree.x - translation.x, LFTree.y - translation.y, LFTree.z - translation.z)); }