public CrossSectionCurve(CrossSectionCurve curveToCopy) { crossSectionsTree = new LLRedBlackTree <CrossSection>(); List <CrossSection> sections = curveToCopy.crossSectionsTree.InOrderTraversal(); for (int i = 0; i < sections.Count; i++) { crossSectionsTree.Insert(sections[i]); } }
private static List <CrossSectionEvent> GenerateEventQueue(List <Line> meshLines, int numCrossSections) { float upperBound = float.NegativeInfinity, lowerBound = float.PositiveInfinity; LLRedBlackTree <CrossSectionEvent> eventQueue = new LLRedBlackTree <CrossSectionEvent>(); for (int i = 0; i < meshLines.Count; i++) { Line line = meshLines[i]; CrossSectionEvent point1Event = new CrossSectionEvent(); CrossSectionEvent point2Event = new CrossSectionEvent(); point1Event.line = line; point1Event.point = line.point1.y; point1Event.crossSectionCut = false; eventQueue.Insert(point1Event); point2Event.line = line; point2Event.point = line.point2.y; point2Event.crossSectionCut = false; eventQueue.Insert(point2Event); upperBound = Math.Max(upperBound, line.point1.y); upperBound = Math.Max(upperBound, line.point2.y); lowerBound = Math.Min(lowerBound, line.point1.y); lowerBound = Math.Min(lowerBound, line.point2.y); } upperBound -= float.Epsilon * 16; lowerBound += float.Epsilon * 16; float stepSize = (upperBound - lowerBound) / ((float)numCrossSections - 1); for (int i = 0; i < numCrossSections; i++) { CrossSectionEvent crossSectionCut = new CrossSectionEvent(); crossSectionCut.point = stepSize * (float)i + lowerBound; crossSectionCut.crossSectionCut = true; eventQueue.Insert(crossSectionCut); } return(eventQueue.InOrderTraversal()); }
public CrossSectionCurve() { crossSectionsTree = new LLRedBlackTree <CrossSection>(); }