/// <summary> /// Transforms the object or a deformable representation of the object. /// </summary> /// <param name="xform"> Transformation matrix. </param> /// <returns> Transformed geometry. If the local geometry can be transformed accurately, /// then the returned instance equals this instance. Not all geometry types can be accurately /// transformed under all circumstances though, if this is the case, this function will /// return an instance of another IGH_GeometricGoo derived type which can be transformed.</returns> public override IGH_GeometricGoo Transform(Transform xform) { if (Value == null) { return(null); } else if (Value.IsValid == false) { return(null); } else if (Value is ExternalAxis) { // Get value and duplicate ExternalAxis externalAxis = Value.DuplicateExternalAxis(); // Transform externalAxis.Transform(xform); // Make new Goo instance GH_ExternalAxis externalAxisGoo = new GH_ExternalAxis(externalAxis); // Return return(externalAxisGoo); } return(null); }
/// <summary> /// Data constructor: Creates a External Axis Goo instance from another External Axis Goo instance. /// This creates a shallow copy of the passed External Axis Goo instance. /// </summary> /// <param name="externalAxisGoo"> External Axis Goo instance to copy </param> public GH_ExternalAxis(GH_ExternalAxis externalAxisGoo) { if (externalAxisGoo == null) { externalAxisGoo = new GH_ExternalAxis(); } this.Value = externalAxisGoo.Value; }
/// <summary> /// Attempt a cast from generic object. /// </summary> /// <param name="source"> Reference to source of cast. </param> /// <returns> True on success, false on failure. </returns> public override bool CastFrom(object source) { if (source == null) { return(false); } //Cast from External Axis if (typeof(ExternalAxis).IsAssignableFrom(source.GetType())) { Value = source as ExternalAxis; return(true); } //Cast from External Axis Goo if (typeof(GH_ExternalAxis).IsAssignableFrom(source.GetType())) { GH_ExternalAxis externalAxisGoo = source as GH_ExternalAxis; Value = externalAxisGoo.Value as ExternalAxis; return(true); } //Cast from External Linear Axis if (typeof(ExternalLinearAxis).IsAssignableFrom(source.GetType())) { Value = source as ExternalAxis; return(true); } //Cast from External Linear Axis Goo if (typeof(GH_ExternalLinearAxis).IsAssignableFrom(source.GetType())) { GH_ExternalLinearAxis externalLinearAxisGoo = source as GH_ExternalLinearAxis; Value = externalLinearAxisGoo.Value as ExternalAxis; return(true); } //Cast from External Rotatioanl Axis if (typeof(ExternalRotationalAxis).IsAssignableFrom(source.GetType())) { Value = source as ExternalAxis; return(true); } //Cast from External Rotational Axis Goo if (typeof(GH_ExternalRotationalAxis).IsAssignableFrom(source.GetType())) { GH_ExternalRotationalAxis externalRotationalAxisGoo = source as GH_ExternalRotationalAxis; Value = externalRotationalAxisGoo.Value as ExternalAxis; return(true); } return(false); }