Ejemplo n.º 1
0
        public void UpdateGeometry(double localGrowthAngleStart, double growthLengthStart,
                                   double localGrowthAngleEnd, double growthLengthEnd)
        {
            // End tip
            double globalAngleEnd = MathUtilities.WrapAngle(localGrowthAngleEnd + endTipSystem.RotationAngle);
            double dxEnd          = growthLengthEnd * Math.Cos(globalAngleEnd);
            double dyEnd          = growthLengthEnd * Math.Sin(globalAngleEnd);
            var    oldEndTip      = Vertices.Last.Value;;
            var    newEndTip      = new CartesianPoint(oldEndTip.X + dxEnd, oldEndTip.Y + dyEnd);

            Vertices.AddLast(newEndTip);
            Segments.AddLast(new DirectedSegment2D(oldEndTip, newEndTip));
            Angles.AddLast(localGrowthAngleEnd); // These are independent of the global coordinate system
            endTipSystem = new TipCoordinateSystem(newEndTip, globalAngleEnd);

            //StartTip
            double globalAngleStart = MathUtilities.WrapAngle(localGrowthAngleStart + startTipSystem.RotationAngle);
            double dxStart          = growthLengthStart * Math.Cos(globalAngleStart);
            double dyStart          = growthLengthStart * Math.Sin(globalAngleStart);
            var    oldStartTip      = Vertices.First.Value;
            var    newStartTip      = new CartesianPoint(oldStartTip.X + dxEnd, oldStartTip.Y + dyEnd);

            Vertices.AddFirst(newStartTip);
            Segments.AddFirst(new DirectedSegment2D(newStartTip, oldStartTip));
            Angles.AddFirst(-localGrowthAngleEnd); // From new to old start segment, use the opposite angle
            endTipSystem = new TipCoordinateSystem(newStartTip, globalAngleStart);
        }
Ejemplo n.º 2
0
 public void AddTwinVertex(TwinVertex tv)
 {
     Log.Info("Adding TwinVertex " + tv.Name + " with precursor " + (tv.Precursor != null ? tv.Precursor.Name : "NULL"));
     Vertices.AddLast(tv);
     if (!tv.B.IsInMatching && !tv.A.IsInMatching)
     {
         AddArc(StartVertex, tv.B, false);
         AddArc(tv.A, EndVertex, false);
     }
 }
Ejemplo n.º 3
0
        public void InitializeGeometry(CartesianPoint startTip, CartesianPoint endTip)
        {
            double dx           = endTip.X - startTip.X;
            double dy           = endTip.Y - startTip.Y;
            double tangentSlope = Math.Atan2(dy, dx);

            endTipSystem   = new TipCoordinateSystem(endTip, tangentSlope);
            startTipSystem = new TipCoordinateSystem(startTip, tangentSlope + Math.PI);

            Vertices.AddLast(startTip);
            Vertices.AddLast(endTip);
            Segments.AddLast(new DirectedSegment2D(startTip, endTip));
        }
Ejemplo n.º 4
0
        private void AddEdgesAndVerticesFrom(IEnumerable <Face> faces)
        {
            var verticesSet = new HashSet <Vertex>();

            foreach (var face in faces)
            {
                Edges.AddLast(face.Edges);
                foreach (var edge in face.Edges)
                {
                    verticesSet.Add(edge.Vertex1);
                    verticesSet.Add(edge.Vertex2);
                }
            }
            Vertices.AddLast(verticesSet);
        }