Comments and answers for "How to build a perpendicular of a certain length for a segment rotated to some angle?"
http://answers.unity.com/questions/1458210/how-to-build-a-perpendicular-of-a-certain-length-f.html
The latest comments and answers for the question "How to build a perpendicular of a certain length for a segment rotated to some angle?"Comment by Ixniy on Ixniy's answer
http://answers.unity.com/comments/1460748/view.html
![alt text][1]
Excellent, thanks!
[1]: /storage/temp/110175-honeycam-2018-01-27-22-36-13.gifSat, 27 Jan 2018 19:38:01 GMTIxniyComment by Ixniy on Ixniy's answer
http://answers.unity.com/comments/1459453/view.html
Thanks for the answer! I'll check your solution in the near future, thank you again.Wed, 24 Jan 2018 20:01:28 GMTIxniyAnswer by hrishihawk
http://answers.unity.com/answers/1458294/view.html
You can use the concept of vectors to get the perpendicular line.Referring the following website [Perpendicular Vector][1] I have made a method that returns the coordinates of C.
/*
This funcion return the coordinates of C
start = Start point of the line segment (A in your case)
end = end point of the line segment (B)
origin = from which point you wan to draw a perpendicular (A in your case)
length = length of the perpendicular
*/
private Vector2 perpendicularVector2(Vector2 start, Vector2 end,Vector2 origin,int length)
{
Vector2 direction = (end - start).normalized;
Vector2 perpendicularDirection = new Vector2(-1*direction.y,direction.x).normalized;
Vector2 requiredLengthVector2 = perpendicularDirection * length;
Vector2 resulVector2 =new Vector2( requiredLengthVector2.x + origin.x , requiredLengthVector2.y+origin.y);
return resulVector2;
}
[1]: http://mathworld.wolfram.com/PerpendicularVector.htmlMon, 22 Jan 2018 14:23:33 GMThrishihawk