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 answers for the question "How to build a perpendicular of a certain length for a segment rotated to some angle?"Answer 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