/// <summary> /// Data constructor: Creates an External Rotational Axis Goo instance from another External Rotational Axis Goo instance. /// This creates a shallow copy of the passed External Rotational Axis Goo instance. /// </summary> /// <param name="externalRotationalAxisGoo"> External Rotational Axis Goo instance to copy. </param> public GH_ExternalRotationalAxis(GH_ExternalRotationalAxis externalRotationalAxisGoo) { if (externalRotationalAxisGoo == null) { externalRotationalAxisGoo = new GH_ExternalRotationalAxis(); } this.Value = externalRotationalAxisGoo.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); }
/// <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 { // Duplicate value ExternalRotationalAxis externalRotationalAxis = Value.Duplicate(); // Transform externalRotationalAxis.Transform(xform); // Make new Goo instance GH_ExternalRotationalAxis externalRotationalAxisGoo = new GH_ExternalRotationalAxis(externalRotationalAxis); // Return return(externalRotationalAxisGoo); } }