Esempio n. 1
0
        public Ray2D(Point2D referencePoint, double angleInDegrees)
        {
            ReferencePoint = referencePoint;
            AngleInDegrees = angleInDegrees;
            var direction = new Point2D(referencePoint.X + 1, referencePoint.Y).RotateAroundReferencePoint(angleInDegrees, referencePoint);

            LineEquation = LineEquation.FromPoints(ReferencePoint, direction);
        }
        public Point2D?CalculateIntersection(LineEquation otherEquation)
        {
            if (otherEquation.SlopeInterceptEquation.HasValue)
            {
                return(CalculateIntersection(otherEquation.SlopeInterceptEquation.Value));
            }

            var x = otherEquation.X !.Value;
            var y = CalculateY(x);

            return(new Point2D(x, y));
        }
 public LineSegment2D(Point2D point1, Point2D point2)
 {
     Point1       = point1;
     Point2       = point2;
     LineEquation = LineEquation.FromPoints(point1, point2);
 }