public BufferEdgeBuilder(CGAlgorithms cga, LineIntersector li, double distance, bool makePrecise, int quadrantSegments) { this._cga = cga; this._distance = distance; //lineBuilder = new BufferMultiLineBuilder(cga, li); _lineBuilder = new BufferLineBuilder(_cga, li, makePrecise,quadrantSegments); }
public BufferLineBuilder(CGAlgorithms _cga, LineIntersector li, bool makePrecise, int quadrantSegments) { this._cga = _cga; this._li = li; this._makePrecise = makePrecise; _angleInc = Math.PI / 2.0 / quadrantSegments; _lineList = new ArrayList(); // ensure array has exactly one element _lineList.Add(arrayTypeCoordinate); }
public BufferLineBuilder(CGAlgorithms _cga, LineIntersector li, bool makePrecise) : this(_cga, li, makePrecise, DefaultQuadrantSegments) { }
/// <summary> /// Initializes a new instance of the BufferMultiLineBuilder class. /// </summary> /// <param name="cga"></param> /// <param name="li"></param> public BufferMultiLineBuilder(CGAlgorithms cga, LineIntersector li) { _cga = cga; _li = li; _angleInc = Math.PI / 2.0 / QUADRANT_SEGMENTS; } // public BufferMultiLineBuilder(CGAlgorithms cga, LineIntersector li)
/// <summary> /// /// </summary> /// <param name="li"></param> /// <returns></returns> public SegmentIntersector ComputeSelfNodes(LineIntersector li) { SegmentIntersector si = new SegmentIntersector( li, true, false); //EdgeSetIntersector esi = new MCQuadIntersector(); _edgeSetIntersector.ComputeIntersections( _edges, si ); //Trace.WriteLine( "SegmentIntersector # tests = " + si._numTests ); AddSelfIntersectionNodes( _argIndex ); return si; }
/// <summary> /// /// </summary> /// <param name="g"></param> /// <param name="li"></param> /// <param name="includeProper"></param> /// <returns></returns> public SegmentIntersector ComputeEdgeIntersections( GeometryGraph g, LineIntersector li, bool includeProper) { SegmentIntersector si = new SegmentIntersector( li, includeProper, true); si.SetBoundaryNodes( GetBoundaryNodes(), g.GetBoundaryNodes() ); EdgeSetIntersector esi = new SimpleMCSweepLineIntersector(); esi.ComputeIntersections( _edges, g.Edges, si ); /* foreach ( object obj in g ) { Edge e = (Edge) obj; Trace.WriteLine( e.EdgeIntersectionList.ToString() ); } */ return si; }
/// <summary> /// Adds EdgeIntersections for one or both intersections found for a segment of an edge to the edge intersection list. /// </summary> /// <param name="li"></param> /// <param name="segmentIndex"></param> /// <param name="geomIndex"></param> public void AddIntersections( LineIntersector li, int segmentIndex, int geomIndex ) { for (int i = 0; i < li.GetIntersectionNum(); i++) { AddIntersection( li, segmentIndex, geomIndex, i ); } }
/// <summary> /// Add an EdgeIntersection for intersection intIndex. /// </summary> /// <remarks> /// An intersection that falls exactly on a vertex of the edge is normalized /// to use the higher of the two possible segmentIndexes /// </remarks> /// <param name="li"></param> /// <param name="segmentIndex"></param> /// <param name="geomIndex"></param> /// <param name="intIndex"></param> public void AddIntersection(LineIntersector li, int segmentIndex, int geomIndex, int intIndex) { Coordinate intPt = new Coordinate( li.GetIntersection( intIndex ) ); int normalizedSegmentIndex = segmentIndex; double dist = li.GetEdgeDistance( geomIndex, intIndex ); //Trace.WriteLine("edge intpt: " + intPt + " dist: " + dist); // normalize the intersection point location int nextSegIndex = normalizedSegmentIndex + 1; if ( nextSegIndex < _pts.Count ) { Coordinate nextPt = _pts[nextSegIndex]; //Trace.WriteLine("next pt: " + nextPt); if ( intPt.Equals( nextPt ) ) { //Trace.WriteLine("normalized distance"); normalizedSegmentIndex = nextSegIndex; dist = 0.0; } } //Add the intersection point to edge intersection list. EdgeIntersection ei = _eiList.Add( intPt, normalizedSegmentIndex, dist ); //Trace.WriteLine( ei.ToString() ); }
public SegmentIntersector(LineIntersector lineIntersector, bool includeProper, bool recordIsolated) { _lineIntersector = lineIntersector; _includeProper = includeProper; _recordIsolated = recordIsolated; }
private bool IsBoundaryPoint(LineIntersector lineIntersector, ArrayList bdyNodes) { //int i = lineIntersector.GetHashCode(); //int j = _lineIntersector.GetHashCode(); foreach (object objectNode in bdyNodes) { Node node = (Node)objectNode; Coordinate pt = node.Coordinate; if ( lineIntersector.IsIntersection(pt) ) { return true; } } return false; }
private bool IsBoundaryPoint(LineIntersector lineIntersector, ArrayList[] bdyNodes) { //int i = lineIntersector.GetHashCode(); //int j = _lineIntersector.GetHashCode(); if ( bdyNodes == null ) return false; if ( IsBoundaryPoint( lineIntersector, bdyNodes[0]) ) return true; if ( IsBoundaryPoint( lineIntersector, bdyNodes[1]) ) return true; return false; }