public sPolyLine DuplicatesPolyline() { List <sXYZ> vts = new List <sXYZ>(); foreach (sXYZ v in this.vertice) { vts.Add(v.DuplicatesXYZ()); } sPolyLine np = new sPolyLine(vts, this.isClosed); np.objectGUID = this.objectGUID; return(np); }
public bool Intersect(sCurve c, double tol, out List <sXYZ> intPts, out List <sCurve> intCrvs) { bool doesIntersect = false; List <sXYZ> ips = new List <sXYZ>(); List <sCurve> ics = new List <sCurve>(); if (this.curveType == eCurveType.LINE && c.curveType == eCurveType.LINE) { sLine l1 = this as sLine; sLine l2 = c as sLine; sGeometryBase igeo; doesIntersect = l1.GetIntersection(l2, tol, out igeo); if (igeo is sLine) { ics.Add(igeo as sCurve); } else if (igeo is sXYZ) { ips.Add(igeo as sXYZ); } } else if (this.curveType == eCurveType.LINE && c.curveType == eCurveType.POLYLINE) { sPolyLine pl = c as sPolyLine; pl.GetIntersection(this, tol, out ips, out ics); } else if (this.curveType == eCurveType.POLYLINE && c.curveType == eCurveType.LINE) { sPolyLine pl = this as sPolyLine; pl.GetIntersection(c, tol, out ips, out ics); } else if (this.curveType == eCurveType.POLYLINE && c.curveType == eCurveType.POLYLINE) { sPolyLine pl = this as sPolyLine; pl.GetIntersection(c, tol, out ips, out ics); } intCrvs = ics; intPts = ips; return(doesIntersect); }
public sCurve DuplicatesCurve() { if (this.curveType == eCurveType.LINE) { sLine sc = this as sLine; return(sc.DuplicatesLine()); } else if (this.curveType == eCurveType.POLYLINE) { sPolyLine thispl = this as sPolyLine; return(thispl.DuplicatesPolyline()); } else if (this.curveType == eCurveType.NURBSCURVE) { sNurbsCurve nc = this as sNurbsCurve; return(nc.DuplicatesNurbsCurve()); } else { return(null); } }
public bool GetIntersection(sCurve pl, double tolerance, out List <sXYZ> intPoints, out List <sCurve> intCurves) { bool doesIntersect = false; List <sXYZ> intPts = new List <sXYZ>(); List <sCurve> intCrvs = new List <sCurve>(); if (pl.curveType == eCurveType.LINE) { for (int i = 0; i < this.segments.Count; ++i) { sGeometryBase igeo; if (this.segments[i].GetIntersection(pl as sLine, tolerance, out igeo)) { if (igeo is sLine) { intCrvs.Add(igeo as sCurve); } if (igeo is sXYZ) { intPts.Add(igeo as sXYZ); } } } } else if (pl.curveType == eCurveType.POLYLINE) { sPolyLine pln = pl as sPolyLine; for (int i = 0; i < this.segments.Count; ++i) { List <sXYZ> tempIntPts = new List <sXYZ>(); for (int j = 0; j < pln.segments.Count; ++j) { sGeometryBase igeo; if (this.segments[i].GetIntersection(pln.segments[j], tolerance, out igeo)) { if (igeo is sLine) { intCrvs.Add(igeo as sCurve); } if (igeo is sXYZ) { tempIntPts.Add(igeo as sXYZ); } } } foreach (sXYZ ip in tempIntPts.OrderBy(p => p.ParameterOn(this.segments[i]))) { intPts.Add(ip); } } } else if (pl.curveType == eCurveType.NURBSCURVE) { } //cull if intpoint is on intcurve? intPoints = intPts; intCurves = intCrvs; return(doesIntersect); }