internal Diagonal(Tangent leftTangent, Tangent rightTangent) { this.LeftTangent = leftTangent; this.RightTangent = rightTangent; }
private void ProcessPolygonQ(Polygon q) { TangentPair tangentPair = new TangentPair(currentPolygon, q); if (this.useLeftPTangents) tangentPair.CalculateLeftTangents(); else tangentPair.CalculateRightTangents(); Tuple<int, int> couple = useLeftPTangents ? tangentPair.leftPLeftQ : tangentPair.rightPLeftQ; Tangent t0 = new Tangent(currentPolygon[couple.Item1], q[couple.Item2]); t0.IsLow = true; t0.SeparatingPolygons = !this.useLeftPTangents; couple = useLeftPTangents ? tangentPair.leftPRightQ : tangentPair.rightPRightQ; Tangent t1 = new Tangent(currentPolygon[couple.Item1], q[couple.Item2]); t1.IsLow = false; t1.SeparatingPolygons = this.useLeftPTangents; t0.Comp = t1; t1.Comp = t0; this.tangents.Add(t0); this.tangents.Add(t1); this.diagonals.Add(new Diagonal(t0, t1)); }
/// <summary> /// compare tangents by measuring the counterclockwise angle between the tangent and the edge /// </summary> /// <param name="e0"></param> /// <param name="e1"></param> /// <returns></returns> int TangentComparison(Tangent e0, Tangent e1) { return StemStartPointComparer.CompareVectorsByAngleToXAxis(e0.End.Point - e0.Start.Point, e1.End.Point - e1.Start.Point); }
private void AddVisibleEdge(Tangent t) { VisibilityGraph.AddEdge(visibilityGraph.GetVertex(t.Start), visibilityGraph.GetVertex(t.End)); }
/// <summary> /// compare tangents by measuring the counterclockwise angle between the tangent and the edge /// </summary> /// <param name="e0"></param> /// <param name="e1"></param> /// <returns></returns> int TangentComparison(Tangent e0, Tangent e1) { return(StemStartPointComparer.CompareVectorsByAngleToXAxis(e0.End.Point - e0.Start.Point, e1.End.Point - e1.Start.Point)); }