/// <summary> /// /// </summary> /// <param name="p0"></param> /// <param name="p1"></param> public static Orient2d CreateFromPoints(Vec2d p0, Vec2d p1) { return(new Orient2d(p0, p1 - p0)); }
/// <summary> /// /// </summary> /// <param name="rotation"></param> /// <param name="translation"></param> public Orient2d(OrthoBasis2d rotation, Vec2d translation) { Rotation = rotation; Translation = translation; }
/// <summary> /// Applies the inverse of this transformation to the given point. /// </summary> /// <param name="point"></param> /// <returns></returns> public Vec2d ApplyInverse(Vec2d point) { return(Rotation.ApplyInverse(point - Translation)); }
/// <summary> /// /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="z"></param> public void Deconstruct(out OrthoBasis2d rotation, out Vec2d translation) { rotation = Rotation; translation = Translation; }
/// <summary> /// Inverts this transformation in place. /// </summary> public void Invert() { Rotation.Invert(); Translation = -Rotation.Apply(Translation); }
/// <summary> /// Applies this transformation to the given point. /// </summary> /// <param name="point"></param> /// <returns></returns> public Vec2d Apply(Vec2d point) { return(Rotation.Apply(point) + Translation); }
/// <summary> /// /// </summary> /// <param name="cosAngle"></param> /// <param name="sinAngle"></param> private Rotation2d(double cosAngle, double sinAngle) { _x = new Vec2d(cosAngle, sinAngle); }
/// <summary> /// /// </summary> /// <param name="origin"></param> /// <param name="x"></param> public Orient2d(Vec2d origin, Vec2d x) { Rotation = new OrthoBasis2d(x); Translation = origin; }
/// <summary> /// /// </summary> /// <param name="x"></param> public Rotation2d(Vec2d x) { _x = x.Unit; }
/// <summary> /// Applies the inverse of this rotation to the given vector. /// </summary> /// <param name="vector"></param> /// <returns></returns> public Vec2d ApplyInverse(Vec2d vector) { return(new Vec2d(Vec2d.Dot(vector, X), Vec2d.Dot(vector, Y))); }
/// <summary> /// Applies this rotation to the given vector. /// </summary> /// <param name="vector"></param> /// <returns></returns> public Vec2d Apply(Vec2d vector) { return(vector.X * X + vector.Y * Y); }
/// <summary> /// /// </summary> /// <param name="angle"></param> public void Set(double angle) { _x = new Vec2d(Math.Cos(angle), Math.Sin(angle)); }
/// <summary> /// /// </summary> /// <param name="other"></param> /// <param name="z"></param> public Vec3d(Vec2d other, double z) { X = other.X; Y = other.Y; Z = z; }