本文整理汇总了C#中GeometryTutorLib.ConcreteAST.Segment.FindIntersection方法的典型用法代码示例。如果您正苦于以下问题:C# Segment.FindIntersection方法的具体用法?C# Segment.FindIntersection怎么用?C# Segment.FindIntersection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeometryTutorLib.ConcreteAST.Segment
的用法示例。
在下文中一共展示了Segment.FindIntersection方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page306Theorem7_4_1
//Demonstrates: congruent chords have congruent arcs
public Page306Theorem7_4_1(bool onoff, bool complete)
: base(onoff, complete)
{
Point o = new Point("O", 0, 0); points.Add(o);
Point r = new Point("R", -3, 4); points.Add(r);
Point s = new Point("S", 2, Math.Sqrt(21)); points.Add(s);
Point t = new Point("T", 2, -Math.Sqrt(21)); points.Add(t);
Point u = new Point("U", -3, -4); points.Add(u);
Segment rt = new Segment(r, t);
Segment su = new Segment(s, u);
Point v = rt.FindIntersection(su); points.Add(v);
Segment rs = new Segment(r, s); segments.Add(rs);
Segment ut = new Segment(u, t); segments.Add(ut);
Circle c = new Circle(o, 5.0);
circles.Add(c);
parser = new LiveGeometry.TutorParser.HardCodedParserMain(points, collinear, segments, circles, onoff);
given.Add(new GeometricCongruentSegments(rs, ut));
MinorArc a1 = (MinorArc)parser.Get(new MinorArc(c, r, s));
MinorArc a2 = (MinorArc)parser.Get(new MinorArc(c, t, u));
MajorArc ma1 = (MajorArc)parser.Get(new MajorArc(c, r, s));
MajorArc ma2 = (MajorArc)parser.Get(new MajorArc(c, t, u));
goals.Add(new GeometricCongruentArcs(a1, a2));
goals.Add(new GeometricCongruentArcs(ma1, ma2));
}
示例2: Test04
//Demonstrates: ExteriorAngleHalfDifferenceInterceptedArcs : two secants
public Test04(bool onoff, bool complete)
: base(onoff, complete)
{
//Circle
Point o = new Point("O", 0, 0); points.Add(o);
Circle circleO = new Circle(o, 5.0);
circles.Add(circleO);
//Intersection point for two secants
Point x = new Point("X", 0, 6); points.Add(x);
//Secant intersection points for circle O
Point a = new Point("A", -3, -4); points.Add(a);
Point b = new Point("B", 3, -4); points.Add(b);
Point c, d, trash;
circleO.FindIntersection(new Segment(b, x), out c, out trash);
if (b.StructurallyEquals(c)) c = trash;
c = new Point("C", c.X, c.Y);
points.Add(c);
circleO.FindIntersection(new Segment(a, x), out d, out trash);
if (a.StructurallyEquals(d)) d = trash;
d = new Point("D", d.X, d.Y);
points.Add(d);
//Create point for another arc (Arc(CE)) of equal measure to (1/2)*(Arc(AB)-Arc(CD))
Point e = new Point("E", 3, 4); points.Add(e);
//Should now be able to form segments for a central angle of equal measure to (1/2)*(Arc(AB)-Arc(CD))
Segment oc = new Segment(o, c); segments.Add(oc);
Segment oe = new Segment(o, e); segments.Add(oe);
//Label the intersection betweeen OE and BX
Point i = oe.FindIntersection(new Segment(b, x));
i = new Point("I", i.X, i.Y); points.Add(i);
List<Point> pnts = new List<Point>();
pnts.Add(a);
pnts.Add(d);
pnts.Add(x);
collinear.Add(new Collinear(pnts));
pnts = new List<Point>();
pnts.Add(b);
pnts.Add(i);
pnts.Add(c);
pnts.Add(x);
collinear.Add(new Collinear(pnts));
parser = new GeometryTutorLib.TutorParser.HardCodedParserMain(points, collinear, segments, circles, onoff);
MinorArc farMinor1 = (MinorArc)parser.Get(new MinorArc(circleO, a, b));
MinorArc closeMinor1 = (MinorArc)parser.Get(new MinorArc(circleO, c, d));
MinorArc centralAngleArc = (MinorArc)parser.Get(new MinorArc(circleO, c, e));
given.Add(new GeometricArcEquation(new Multiplication(new NumericValue(2), centralAngleArc), new Subtraction(farMinor1, closeMinor1)));
goals.Add(new GeometricCongruentAngles((Angle)parser.Get(new Angle(a, x, b)), (Angle)parser.Get(new Angle(c, o, e))));
}
示例3: Test08
//Demonstrates: If two inscribed angles intercept the same arc, the angles are congruent
public Test08(bool onoff, bool complete)
: base(onoff, complete)
{
//Points for chord BAC
Point a = new Point("A", -1, -System.Math.Sqrt(24)); points.Add(a);
Point b = new Point("B", -3, 4); points.Add(b);
Point c = new Point("C", 2, System.Math.Sqrt(21)); points.Add(c);
//Points for angle BDC
Point d = new Point("D", 3, -4); points.Add(d);
//Lable the intersection between BD and AC
Segment ac = new Segment(a, c);
Segment db = new Segment(d, b);
Point i = ac.FindIntersection(db);
i = new Point("I", i.X, i.Y); points.Add(i);
//Segments for both angles
Segment ab = new Segment(a, b); segments.Add(ab);
Segment dc = new Segment(d, c); segments.Add(dc);
List<Point> pnts = new List<Point>();
pnts.Add(a);
pnts.Add(i);
pnts.Add(c);
collinear.Add(new Collinear(pnts));
pnts = new List<Point>();
pnts.Add(d);
pnts.Add(i);
pnts.Add(b);
collinear.Add(new Collinear(pnts));
//Circle
Point o = new Point("O", 0, 0); points.Add(o);
Circle circleO = new Circle(o, 5.0);
circles.Add(circleO);
parser = new GeometryTutorLib.TutorParser.HardCodedParserMain(points, collinear, segments, circles, onoff);
goals.Add(new GeometricCongruentAngles((Angle)parser.Get(new Angle(b, a, c)), (Angle)parser.Get(new Angle(b, d, c))));
}
示例4: Test07
//Demonstrates: Measure of an angle formed by two chords that intersect inside a circle is equal to half the sum of the measures
//of the intercepted arcs
//To see use of theorem, need to turn off VERTICAL_ANGLES and RELATIONS_OF_CONGRUENT_ANGLES_ARE_CONGRUENT in JustificationSwitch
public Test07(bool onoff, bool complete)
: base(onoff, complete)
{
//Circle
Point o = new Point("O", 0, 0); points.Add(o);
Circle circleO = new Circle(o, 5.0);
circles.Add(circleO);
//Points for chord ab
Point a = new Point("A", -3, 4); points.Add(a);
Point b = new Point("B", 3, -4); points.Add(b);
//Points for chord cd
Point c = new Point("C", -3, -4); points.Add(c);
Point d = new Point("D", 1, System.Math.Sqrt(24)); points.Add(d);
//Find intersection point of ab and cd
Segment ab = new Segment(a, b);
Segment cd = new Segment(c, d);
Point inter = ab.FindIntersection(cd);
Point z = new Point("Z", inter.X, inter.Y); points.Add(z);
List<Point> pnts = new List<Point>();
pnts.Add(a);
pnts.Add(z);
pnts.Add(b);
collinear.Add(new Collinear(pnts));
pnts = new List<Point>();
pnts.Add(c);
pnts.Add(z);
pnts.Add(d);
collinear.Add(new Collinear(pnts));
parser = new LiveGeometry.TutorParser.HardCodedParserMain(points, collinear, segments, circles, onoff);
goals.Add(new GeometricCongruentAngles((Angle)parser.Get(new Angle(a, z, d)), (Angle)parser.Get(new Angle(c, z, b))));
goals.Add(new GeometricCongruentAngles((Angle)parser.Get(new Angle(a, z, c)), (Angle)parser.Get(new Angle(b, z, d))));
}
示例5: Page309Problem09
//Demonstrates: Congruent chords have congruent arcs (and converse); arc addition axiom
public Page309Problem09(bool onoff, bool complete)
: base(onoff, complete)
{
Point o = new Point("O", 0, 0); points.Add(o);
Point r = new Point("R", -3, 4); points.Add(r);
Point s = new Point("S", 2, Math.Sqrt(21)); points.Add(s);
Point t = new Point("T", 2, -Math.Sqrt(21)); points.Add(t);
Point u = new Point("U", -3, -4); points.Add(u);
Segment rt = new Segment(r, t);
Segment su = new Segment(s, u);
Point v = rt.FindIntersection(su); points.Add(v);
Segment rs = new Segment(r, s); segments.Add(rs);
Segment ut = new Segment(u, t); segments.Add(ut);
List<Point> pnts = new List<Point>();
pnts.Add(r);
pnts.Add(v);
pnts.Add(t);
collinear.Add(new Collinear(pnts));
pnts = new List<Point>();
pnts.Add(s);
pnts.Add(v);
pnts.Add(u);
collinear.Add(new Collinear(pnts));
Circle c = new Circle(o, 5.0);
circles.Add(c);
parser = new GeometryTutorLib.TutorParser.HardCodedParserMain(points, collinear, segments, circles, onoff);
given.Add(new GeometricCongruentSegments((Segment)parser.Get(new Segment(r, s)), (Segment)parser.Get(new Segment(u, t))));
goals.Add(new GeometricCongruentSegments((Segment)parser.Get(new Segment(r, t)), (Segment)parser.Get(new Segment(u, s))));
}
示例6: Test03
//Demonstrates: Inscribed angle half measure of intercepted arc and transitive substitution
public Test03(bool onoff, bool complete)
: base(onoff, complete)
{
Point o = new Point("O", 0, 0); points.Add(o);
Point r = new Point("R", -3, 4); points.Add(r);
Point t = new Point("T", 3, 4); points.Add(t);
Point v = new Point("V", -3, -4); points.Add(v);
Point x = new Point("X", 0, -5); points.Add(x);
Segment vr = new Segment(v, r); segments.Add(vr);
Segment tx = new Segment(t, x); segments.Add(tx);
Segment vt = new Segment(v, t);
Segment rx = new Segment(r, x);
Point i = vt.FindIntersection(rx);
i = new Point("I", i.X, i.Y); points.Add(i);
List<Point> pnts = new List<Point>();
pnts.Add(v);
pnts.Add(i);
pnts.Add(o);
pnts.Add(t);
collinear.Add(new Collinear(pnts));
pnts = new List<Point>();
pnts.Add(x);
pnts.Add(i);
pnts.Add(r);
collinear.Add(new Collinear(pnts));
Circle c = new Circle(o, 5.0);
circles.Add(c);
parser = new GeometryTutorLib.TutorParser.HardCodedParserMain(points, collinear, segments, circles, onoff);
goals.Add(new GeometricCongruentAngles((Angle)parser.Get(new Angle(i, v, r)), (Angle)parser.Get(new Angle(i, x, t))));
}
示例7: Atomize
public List<Area_Based_Analyses.Atomizer.AtomicRegion> Atomize(List<Point> figurePoints)
{
List<Segment> constructedChords = new List<Segment>();
List<Segment> constructedRadii = new List<Segment>();
List<Point> imagPoints = new List<Point>();
List<Point> interPts = GetIntersectingPoints();
//
// Construct the radii
//
switch (interPts.Count)
{
// If there are no points of interest, the circle is the atomic region.
case 0:
return Utilities.MakeList<AtomicRegion>(new ShapeAtomicRegion(this));
// If only 1 intersection point, create the diameter.
case 1:
Point opp = Utilities.AcquirePoint(figurePoints, this.OppositePoint(interPts[0]));
constructedRadii.Add(new Segment(center, interPts[0]));
constructedRadii.Add(new Segment(center, opp));
imagPoints.Add(opp);
interPts.Add(opp);
break;
default:
foreach (Point interPt in interPts)
{
constructedRadii.Add(new Segment(center, interPt));
}
break;
}
//
// Construct the chords
//
List<Segment> chords = new List<Segment>();
for (int p1 = 0; p1 < interPts.Count - 1; p1++)
{
for (int p2 = p1 + 1; p2 < interPts.Count; p2++)
{
Segment chord = new Segment(interPts[p1], interPts[p2]);
if (!DefinesDiameter(chord)) constructedChords.Add(chord);
}
}
//
// Do any of the created segments result in imaginary intersection points.
//
foreach (Segment chord in constructedChords)
{
foreach (Segment radius in constructedRadii)
{
Point inter = Utilities.AcquireRestrictedPoint(figurePoints, chord.FindIntersection(radius), chord, radius);
if (inter != null)
{
chord.AddCollinearPoint(inter);
radius.AddCollinearPoint(inter);
// if (!Utilities.HasStructurally<Point>(figurePoints, inter)) imagPoints.Add(inter);
Utilities.AddUnique<Point>(imagPoints, inter);
}
}
}
for (int c1 = 0; c1 < constructedChords.Count - 1; c1++)
{
for (int c2 = c1 + 1; c2 < constructedChords.Count; c2++)
{
Point inter = constructedChords[c1].FindIntersection(constructedChords[c2]);
inter = Utilities.AcquireRestrictedPoint(figurePoints, inter, constructedChords[c1], constructedChords[c2]);
if (inter != null)
{
constructedChords[c1].AddCollinearPoint(inter);
constructedChords[c2].AddCollinearPoint(inter);
//if (!Utilities.HasStructurally<Point>(figurePoints, inter)) imagPoints.Add(inter);
Utilities.AddUnique<Point>(imagPoints, inter);
}
}
}
//
// Add all imaginary points to the list of figure points.
//
Utilities.AddUniqueList<Point>(figurePoints, imagPoints);
//
// Construct the Planar graph for atomic region identification.
//
Area_Based_Analyses.Atomizer.UndirectedPlanarGraph.PlanarGraph graph = new Area_Based_Analyses.Atomizer.UndirectedPlanarGraph.PlanarGraph();
//
// Add all imaginary points, intersection points, and center.
//
foreach (Point pt in imagPoints)
{
graph.AddNode(pt);
}
//.........这里部分代码省略.........
示例8: IsSecant
//
// Determine if the segment passes through the circle (we know it is not a chord since they have been filtered).
//
private bool IsSecant(Segment segment, List<Point> figPoints, out Segment chord)
{
// Make it null and overwrite when necessary.
chord = null;
// Is the segment exterior to the circle, but intersects at an endpoint (and wasn't tangent).
if (this.PointIsExterior(segment.Point1) && this.PointLiesOn(segment.Point2)) return false;
if (this.PointIsExterior(segment.Point2) && this.PointLiesOn(segment.Point1)) return false;
// Is one endpoint of the segment simply on the interior of the circle (so we have nothing)?
if (this.PointIsInterior(segment.Point1) || this.PointIsInterior(segment.Point2)) return false;
if (ContainsDiameter(segment))
{
chord = ConstructChord(segment, this.center, this.radius, figPoints);
// Add radii to the list.
radii.Add(new Segment(this.center, chord.Point1));
radii.Add(new Segment(this.center, chord.Point2));
return true;
}
// Acquire the line perpendicular to the segment that passes through the center of the circle.
Segment perpendicular = segment.GetPerpendicular(this.center);
// Is this perpendicular segment a radius? If so, it's tangent, not a secant
//if (Utilities.CompareValues(perpendicular.Length, this.radius)) return false;
// Is the perpendicular a radius? Check if the intersection of the segment and the perpendicular is on the circle. If so, it's tangent
Point intersection = segment.FindIntersection(perpendicular);
if (this.PointLiesOn(intersection)) return false;
//Adjust perpendicular segment to include intersection with segment
perpendicular = new Segment(intersection, this.center);
// Filter the fact that there are no intersections
if (perpendicular.Length > this.radius) return false;
// 1/2 chord length
// _____ circPoint
// | /
// | /
// perp.Length | / radius
// | /
// |/
// Determine the half-chord length via Pyhtagorean Theorem.
double halfChordLength = Math.Sqrt(Math.Pow(this.radius, 2) - Math.Pow(perpendicular.Length, 2));
chord = ConstructChord(segment, perpendicular.OtherPoint(this.center), halfChordLength, figPoints);
return true;
}
示例9: Midpoint
// return the midpoint between these two on the circle.
public Point Midpoint(Point a, Point b, Point sameSide)
{
Point midpt = Midpoint(a, b);
Segment segment = new Segment(a, b);
Segment other = new Segment(midpt, sameSide);
Point intersection = segment.FindIntersection(other);
if (Segment.Between(intersection, midpt, sameSide)) return this.OppositePoint(midpt);
return midpt;
}
示例10: IsTangent
//
// Determine tangency of the given segment.
// Indicate tangency by returning the segment which creates the 90^0 angle.
//
public Segment IsTangent(Segment segment)
{
// If the center and the segment points are collinear, this will not be a tangent.
if (segment.PointLiesOn(this.center)) return null;
// Acquire the line perpendicular to the segment that passes through the center of the circle.
Segment perpendicular = segment.GetPerpendicular(this.center);
// If the segment was found to pass through the center, it is not a tangent
if (perpendicular.Equals(segment)) return null;
// Is this perpendicular segment a radius? Check length
//if (!Utilities.CompareValues(perpendicular.Length, this.radius)) return null;
// Is the perpendicular a radius? Check that the intersection of the segment and the perpendicular is on the circle
Point intersection = segment.FindIntersection(perpendicular);
if (!this.PointLiesOn(intersection)) return null;
// The intersection between the perpendicular and the segment must be within the endpoints of the segment.
return segment.PointLiesOnAndBetweenEndpoints(intersection) ? perpendicular : null;
}
示例11: IntersectAtSamePoint
public static bool IntersectAtSamePoint(Segment seg1, Segment seg2, Segment seg3)
{
Point intersection1 = seg1.FindIntersection(seg3);
Point intersection2 = seg2.FindIntersection(seg3);
return intersection1.Equals(intersection2);
}
示例12: ConvertToCircleCircle
//
// This is a complex situation because we need to identify situations where circles intersect with the resultant regions:
// (| (|)
// ( | ( | )
// ( | ( | )
// ( | ( | )
// (| (|)
//
// Note: There will always be a chord because of our implied construction.
// We are interested in only minor arcs of the given circles.
//
private List<Atomizer.AtomicRegion> ConvertToCircleCircle(Segment chord,
List<Circle> circles,
out Circle leftOuterCircle,
out Circle rightOuterCircle)
{
List<Atomizer.AtomicRegion> regions = new List<Atomizer.AtomicRegion>();
leftOuterCircle = null;
rightOuterCircle = null;
//
// Simple cases that require no special attention.
//
if (!circles.Any()) return null;
if (circles.Count == 1)
{
leftOuterCircle = circles[0];
regions.AddRange(ConstructBasicLineCircleRegion(chord, circles[0]));
return regions;
}
// All circles that are on each side of the chord
List<Circle> leftSide = new List<Circle>();
List<Circle> rightSide = new List<Circle>();
// For now, assume max, one circle per side.
// Construct a collinear list of points that includes all circle centers as well as the single intersection point between the chord and the line passing through all circle centers.
// This orders the sides and provides implied sizes.
Segment centerLine = new Segment(circles[0].center, circles[1].center);
for (int c = 2; c < circles.Count; c++)
{
centerLine.AddCollinearPoint(circles[c].center);
}
// Find the intersection between the center-line and the chord; add that to the list.
Point intersection = centerLine.FindIntersection(chord);
centerLine.AddCollinearPoint(intersection);
List<Point> collPoints = centerLine.collinear;
int interIndex = collPoints.IndexOf(intersection);
for (int i = 0; i < collPoints.Count; i++)
{
// find the circle based on center
int c;
for (c = 0; c < circles.Count; c++)
{
if (circles[c].center.StructurallyEquals(collPoints[i])) break;
}
// Add the circle in order
if (i < interIndex) leftSide.Add(circles[c]);
else if (i > interIndex) rightSide.Add(circles[c]);
}
// the outermost circle is first in the left list and last in the right list.
if (leftSide.Any()) leftOuterCircle = leftSide[0];
if (rightSide.Any()) rightOuterCircle = rightSide[rightSide.Count - 1];
//
// Main combining algorithm:
// Assume: Increasing Arc sequence A \in A_1, A_2, ..., A_n and the single chord C
//
// Construct region B = (C, A_1)
// For the increasing Arc sequence (k subscript) A_2, A_3, ..., A_n
// B = Construct ((C, A_k) \ B)
//
// Alternatively:
// Construct(C, A_1)
// for each pair Construct (A_k, A_{k+1})
//
//
// Handle each side: left and right.
//
if (leftSide.Any()) regions.AddRange(ConstructBasicLineCircleRegion(chord, leftSide[leftSide.Count - 1]));
for (int ell = 0; ell < leftSide.Count - 2; ell++)
{
regions.Add(ConstructBasicCircleCircleRegion(chord, leftSide[ell], leftSide[ell + 1]));
}
if (rightSide.Any()) regions.AddRange(ConstructBasicLineCircleRegion(chord, rightSide[0]));
for (int r = 1; r < rightSide.Count - 1; r++)
{
regions.Add(ConstructBasicCircleCircleRegion(chord, rightSide[r], rightSide[r + 1]));
}
return regions;
}