-
Notifications
You must be signed in to change notification settings - Fork 0
/
Line.cs
40 lines (37 loc) · 944 Bytes
/
Line.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace raytraicing
{
public class Line
{
public double a, b, c;
public Line(double a, double b, double c)
{
this.a = a;
this.b = b;
this.c = c;
}
public Line(Ray ray)
{
a = ray.DirectingVector.Y;
b = -ray.DirectingVector.X;
c = -a * ray.FirstPoint.X - b * ray.FirstPoint.Y;
}
public Line(Rib rib)
{
a = rib.DirectingVector.Y;
b = -rib.DirectingVector.X;
c = -a * rib.FirstPoint.X - b * rib.FirstPoint.Y;
}
public double GetDistance(Point2D point)
{
return a * point.X + b * point.Y + c;
}
public double GetDistance(Point2DD point)
{
return a * point.X + b * point.Y + c;
}
}
}