/// <summary> /// /// </summary> /// <param name="eye"></param> /// <param name="target"></param> /// <param name="up"></param> /// <returns></returns> public static Orient3d CreateLookAt(Vec3d eye, Vec3d target, Vec3d up) { var rot = new Rotation3d(target - eye, up); rot.SwapZX(); var orient = new Orient3d(rot, eye); orient.Invert(); return(orient); }
/// <summary> /// /// </summary> /// <param name="scale"></param> /// <param name="orientation"></param> public Transform3d(Vec3d scale, Orient3d orientation) { Scale = scale; Rotation = orientation.Rotation; Translation = orientation.Translation; }
/// <summary> /// /// </summary> /// <param name="t0"></param> /// <param name="t1"></param> public static Orient3d Multiply(ref Orient3d t0, ref Orient3d t1) { return(t0.Apply(t1)); }
/// <summary> /// /// </summary> /// <param name="orient"></param> /// <param name="point"></param> /// <returns></returns> public static Vec3d Multiply(ref Orient3d orient, Vec3d point) { return(orient.Apply(point)); }
/// <summary> /// Applies the inverse of this transformation to the given transformation. /// </summary> /// <param name="other"></param> public Orient3d ApplyInverse(Orient3d other) { other.Rotation = Rotation.ApplyInverse(other.Rotation); other.Translation = ApplyInverse(other.Translation); return(other); }
/// <summary> /// /// </summary> /// <param name="t0"></param> /// <param name="t1"></param> /// <returns></returns> public static Orient3d CreateRelative(ref Orient3d t0, ref Orient3d t1) { return(t1.Apply(t0.Inverse)); }
/// <summary> /// /// </summary> /// <param name="from"></param> /// <param name="to"></param> /// <returns></returns> public static Orient3d CreateFromTo(ref Orient3d from, ref Orient3d to) { return(to.Apply(from.Inverse)); }
/// <summary> /// Creates a relative transformation from t0 to t1. /// </summary> /// <param name="t0"></param> /// <param name="t1"></param> /// <returns></returns> public static Orient3d CreateRelative(Orient3d t0, Orient3d t1) { return(CreateRelative(ref t0, ref t1)); }
/// <summary> /// Applies the inverse of this transformation to the given transformation. /// </summary> /// <param name="other"></param> public Orient3d ApplyInverse(Orient3d other) { ApplyInverse(ref other); return(other); }
/// <summary> /// Applies the inverse of this transformation to the given transformation. /// </summary> /// <param name="other"></param> public void ApplyInverse(ref Orient3d other) { Rotation.ApplyInverse(ref other.Rotation); other.Translation = ApplyInverse(other.Translation); }
/// <summary> /// Applies this transformation to the given transformation. /// </summary> /// <param name="other"></param> public Orient3d Apply(Orient3d other) { Apply(ref other); return(other); }
/// <summary> /// /// </summary> /// <param name="other"></param> /// <param name="tolerance"></param> /// <returns></returns> public bool ApproxEquals(ref Orient3d other, double tolerance = SlurMath.ZeroTolerance) { return (Translation.ApproxEquals(other.Translation, tolerance) && Rotation.ApproxEquals(ref other.Rotation, tolerance)); }
/// <summary> /// Applies the inverse of this transformation to the given transformation. /// </summary> /// <param name="other"></param> public void ApplyInverse(ref Orient3d other, ref Orient3d result) { Rotation.ApplyInverse(ref other.Rotation, ref result.Rotation); result.Translation = ApplyInverse(other.Translation); }
/// <summary> /// Applies the inverse of this transformation to the given transformation in place. /// </summary> /// <param name="other"></param> public void ApplyInverse(ref Orient3d other) { ApplyInverse(ref other, ref other); }
/// <summary> /// Applies this transformation to the given transformation in place. /// </summary> /// <param name="other"></param> public void Apply(ref Orient3d other) { Apply(ref other, ref other); }