开发者

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!

c# - problem with finding a point (2D)


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜