本文整理汇总了C#中GeometryTutorLib.ConcreteAST.Segment.IsParallelWith方法的典型用法代码示例。如果您正苦于以下问题:C# Segment.IsParallelWith方法的具体用法?C# Segment.IsParallelWith怎么用?C# Segment.IsParallelWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeometryTutorLib.ConcreteAST.Segment
的用法示例。
在下文中一共展示了Segment.IsParallelWith方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parallel
public Parallel(Segment segment1, Segment segment2)
: base()
{
this.segment1 = segment1;
this.segment2 = segment2;
if (!segment1.IsParallelWith(segment2))
{
throw new ArgumentException("Given lines are not parallel: " + segment1 + " ; " + segment2);
}
}
示例2: Parallelogram
public Parallelogram(Segment left, Segment right, Segment top, Segment bottom)
: base(left, right, top, bottom)
{
if (!left.IsParallelWith(right))
{
throw new ArgumentException("Given opposing segments are not parallel: " + left + " " + right);
}
if (!top.IsParallelWith(bottom))
{
throw new ArgumentException("Given opposing segments are not parallel: " + top + " " + bottom);
}
}
示例3: Trapezoid
public Trapezoid(Segment left, Segment right, Segment top, Segment bottom)
: base(left, right, top, bottom)
{
if (left.IsParallelWith(right))
{
if (left.Length > right.Length)
{
baseSegment = left;
oppBaseSegment = right;
leftLeg = top;
rightLeg = bottom;
}
else
{
baseSegment = right;
oppBaseSegment = left;
leftLeg = top;
rightLeg = bottom;
}
}
else if (top.IsParallelWith(bottom))
{
if (top.Length > bottom.Length)
{
baseSegment = top;
oppBaseSegment = bottom;
leftLeg = left;
rightLeg = right;
}
else
{
baseSegment = bottom;
oppBaseSegment = top;
leftLeg = left;
rightLeg = right;
}
}
else
{
throw new ArgumentException("Quadrilateral does not define a trapezoid; no sides are parallel: " + this);
}
topLeftBaseAngle = GetAngle(new Angle(leftLeg, oppBaseSegment));
topRightBaseAngle = GetAngle(new Angle(rightLeg, oppBaseSegment));
bottomLeftBaseAngle = GetAngle(new Angle(leftLeg, baseSegment));
bottomRightBaseAngle = GetAngle(new Angle(rightLeg, baseSegment));
FindMedian();
}
示例4: CreatesBasicCShape
//
// Creates a basic S-Shape with standsOnEndpoints
//
// offThis ______
// |
// offThat ______|
//
// Return <offThis, offThat>
public KeyValuePair<Point, Point> CreatesBasicCShape(Intersection thatInter)
{
KeyValuePair<Point, Point> nullPair = new KeyValuePair<Point, Point>(null, null);
// A valid transversal is required for this shape
if (!this.CreatesAValidTransversalWith(thatInter)) return nullPair;
if (!this.StandsOnEndpoint()) return nullPair;
if (!thatInter.StandsOnEndpoint()) return nullPair;
//
// Determine offThis and offThat
//
Segment transversal = this.AcquireTransversal(thatInter);
Segment parallelThis = this.OtherSegment(transversal);
Segment parallelThat = thatInter.OtherSegment(transversal);
Point offThis = transversal.PointLiesOnAndBetweenEndpoints(parallelThis.Point1) ? parallelThis.Point2 : parallelThis.Point1;
Point offThat = transversal.PointLiesOnAndBetweenEndpoints(parallelThat.Point1) ? parallelThat.Point2 : parallelThat.Point1;
// Avoid S-shape scenario
Segment crossingTester = new Segment(offThis, offThat);
Point intersection = transversal.FindIntersection(crossingTester);
// We may have parallel crossingTester and transversal; that's ok
if (crossingTester.IsParallelWith(transversal)) return new KeyValuePair<Point, Point>(offThis, offThat);
// S-shape
if (transversal.PointLiesOnAndBetweenEndpoints(intersection)) return nullPair;
// C-Shape
return new KeyValuePair<Point, Point>(offThis, offThat);
}