/***************************************************/ public static ICurve Transform(this Circle curve, TransformMatrix transform) { if (Math.Abs(transform.Determinant() - 1) <= 1e-6 || transform.IsUniformScaling()) { return new Circle { Centre = curve.Centre.Transform(transform), Radius = (curve.StartPoint() - curve.Centre).Transform(transform).Length(), Normal = curve.Normal.Transform(transform) } } ; else { Reflection.Compute.RecordNote("Transformation is not rigid. Converting into NurbsCurve. May occure change in shape"); return(curve.ToNurbsCurve().Transform(transform)); } }
/***************************************************/ public static ICurve Transform(this Circle curve, TransformMatrix transform) { if (transform.IsRigidTransformation() || transform.IsUniformScaling()) { return new Circle { Centre = curve.Centre.Transform(transform), Radius = (curve.StartPoint() - curve.Centre).Transform(transform).Length(), Normal = curve.Normal.Transform(transform) } } ; else { Reflection.Compute.RecordNote("Transformation is not rigid or uniform. Converting into NurbsCurve. Change in shape may occur."); return(curve.ToNurbsCurve().Transform(transform)); } }
/***************************************************/ /**** Public Methods - Curves ****/ /***************************************************/ public static ICurve Transform(this Arc curve, TransformMatrix transform) { if (Math.Abs(transform.Determinant() - 1) <= 1e-6 || transform.IsUniformScaling()) { return new Arc { Radius = (curve.StartPoint() - curve.CoordinateSystem.Origin).Transform(transform).Length(), StartAngle = curve.StartAngle, EndAngle = curve.EndAngle, CoordinateSystem = curve.CoordinateSystem.Transform(transform) } } ; else { Reflection.Compute.RecordNote("Transformation is not rigid. Converting into NurbsCurve. May occure change in shape"); return(curve.ToNurbsCurve().Transform(transform)); } }
/***************************************************/ public static ICurve Transform(this Ellipse curve, TransformMatrix transform) { if (Math.Abs(transform.Determinant() - 1) <= 1e-6 || transform.IsUniformScaling()) { return new Ellipse { Centre = curve.Centre.Transform(transform), Axis1 = curve.Axis1.Transform(transform), Axis2 = curve.Axis2.Transform(transform), Radius1 = (curve.Axis1.Normalise() * curve.Radius1).Transform(transform).Length(), Radius2 = (curve.Axis2.Normalise() * curve.Radius2).Transform(transform).Length(), } } ; else { Reflection.Compute.RecordNote("Transformation is not rigid. Converting into NurbsCurve. May occure change in shape"); return(curve.ToNurbsCurve().Transform(transform)); } }
/***************************************************/ public static ICurve Transform(this Ellipse curve, TransformMatrix transform) { if (transform.IsRigidTransformation() || transform.IsUniformScaling()) { return new Ellipse { Centre = curve.Centre.Transform(transform), Axis1 = curve.Axis1.Transform(transform), Axis2 = curve.Axis2.Transform(transform), Radius1 = (curve.Axis1.Normalise() * curve.Radius1).Transform(transform).Length(), Radius2 = (curve.Axis2.Normalise() * curve.Radius2).Transform(transform).Length(), } } ; else { Reflection.Compute.RecordNote("Transformation is not rigid or uniform. Converting into NurbsCurve. Change in shape may occur."); return(curve.ToNurbsCurve().Transform(transform)); } }