/***************************************************/ /**** Private Methods ****/ /***************************************************/ private static TierProfile MirrorTierYZ(TierProfile originalSection) { //need a clone TierProfile theMappedTier = originalSection.DeepClone(); double x, y, z; for (var p = 0; p < theMappedTier.FloorPoints.Count; p++) { x = theMappedTier.FloorPoints[p].X; y = -theMappedTier.FloorPoints[p].Y; z = theMappedTier.FloorPoints[p].Z; theMappedTier.FloorPoints[p] = Geometry.Create.Point(x, y, z); } for (var p = 0; p < theMappedTier.EyePoints.Count; p++) { x = theMappedTier.EyePoints[p].X; y = -theMappedTier.EyePoints[p].Y; z = theMappedTier.EyePoints[p].Z; theMappedTier.EyePoints[p] = Geometry.Create.Point(x, y, z); } theMappedTier.Profile.ControlPoints = theMappedTier.FloorPoints; theMappedTier.SectionOrigin = DefineTierOrigin(theMappedTier.FloorPoints); return(theMappedTier); }
//this should be a modify method public static TierProfile TransformProfile(TierProfile originalSection, Vector scale, Point source, Point target, double angle) { TierProfile transformedTier = (TierProfile)originalSection.DeepClone(); var xScale = Geometry.Create.ScaleMatrix(source, scale); var xRotate = Geometry.Create.RotationMatrix(source, Vector.ZAxis, angle); var xTrans = Geometry.Create.TranslationMatrix(target - source); TransformTier(ref transformedTier, xScale); TransformTier(ref transformedTier, xRotate); TransformTier(ref transformedTier, xTrans); return(transformedTier); }
public static TierProfile TransformProfile(TierProfile originalSection, Vector scale, Point source, Point target, double angle) { if (originalSection == null) { BH.Engine.Reflection.Compute.RecordError("Cannot modify a null tier profile."); return(originalSection); } if (scale == null) { BH.Engine.Reflection.Compute.RecordError("Cannot transform a tier profile using a null scale vector."); return(originalSection); } if (source == null) { BH.Engine.Reflection.Compute.RecordError("Cannot transform a tier profile from a null source point."); return(originalSection); } if (target == null) { BH.Engine.Reflection.Compute.RecordError("Cannot transform a tier profile from a null target point."); return(originalSection); } TierProfile transformedTier = (TierProfile)originalSection.DeepClone(); var xScale = Geometry.Create.ScaleMatrix(source, scale); var xRotate = Geometry.Create.RotationMatrix(source, Vector.ZAxis, angle); var xTrans = Geometry.Create.TranslationMatrix(target - source); TransformTier(ref transformedTier, xScale); TransformTier(ref transformedTier, xRotate); TransformTier(ref transformedTier, xTrans); return(transformedTier); }