c# - problem with finding a point (2D)
I am working with C# and I have 3 System.Drawing.Point
variables (A
, B
, C
) and the angle of alpha
.
I need to find any point on the side 'a' and don't 开发者_开发问答know how to manage this.
The angles alpha and beta have the same size!
Assuming your text is right and your image wrong, by definition all points on a
follow this equation:
P=t*B+(1-t)*C, 0<=t<=1
Where A
, B
and C
are the extremities of your triangle.
Algebra?
y = m*x + c
Basic line equation. Let's do it from A to B.
First, m = (B.Y - A.Y)/(B.X - A.X)
.
Now substitute A. A.Y = m * A.X + c
. Push stuff about algebraically to find c
.
Now you can find any point between A and B by placing X or Y values into that equation and seeing what Y or X value is produced. Just be careful that you don't overstep the line boundaries.
精彩评论