public static ISegment2D ConvertTo2D(ISegment3D segment3D, IMatrix44 lcs) { var segmentCopy = segment3D.CloneSegment(); GeomOperation.TransformToLCS(lcs, segmentCopy); var segment2D = ConvertTo2D(segmentCopy); return(segment2D); }
/// <summary> /// Convert the points of segment based on baseGeometry /// </summary> /// <param name="matrix">LCS matrix of baseGeometry</param> /// <param name="baseGeometry">Based on this region, the given segment is modifed</param> /// <param name="segment">Input segment object</param> /// <param name="isIndependent">Segment is independent</param> /// <param name="modifyInput">If true, given segment object is modified. Otherwise prepare new segment object</param> /// <returns>Segment object which is based on baseGeometry</returns> public static ISegment3D GetSegmentOnRegion(IMatrix44 matrix, IRegion3D baseGeometry, ISegment3D segment, bool isIndependent = true, bool modifyInput = true) { if (baseGeometry == null || segment == null) { return(null); } if (matrix == null) { matrix = GetMatrixPlane(baseGeometry); } if (!modifyInput) { segment = segment.CloneSegment(); } ILineSegment3D line = segment as ILineSegment3D; if (line != null) { if (isIndependent) { line.StartPoint = GetPointOnRegion(matrix, baseGeometry, line.StartPoint); } line.EndPoint = GetPointOnRegion(matrix, baseGeometry, line.EndPoint); return(line); } IArcSegment3D arc = segment as IArcSegment3D; if (arc != null) { if (isIndependent) { arc.StartPoint = GetPointOnRegion(matrix, baseGeometry, arc.StartPoint); } arc.IntermedPoint = GetPointOnRegion(matrix, baseGeometry, arc.IntermedPoint); arc.EndPoint = GetPointOnRegion(matrix, baseGeometry, arc.EndPoint); return(arc); } throw new NotSupportedException(); }