qertkk.blogg.se

Find perpindicular vector 2d
Find perpindicular vector 2d















I have come up with a solution for the nonce that relies on using parallel lines and line intersection to find the corner points I need in order to draw a "fat" line. The normal abs angle between P1 and P3 in degrees: 180 Public class ThickLineRenderer : MonoBehaviour ", Program.RadiansToDegrees(absNormalAngle)) Maybe I'm trying to do this all wrong and need to instead start with two parallel lines set "thickness" apart from the points comprising the line and calculate the intersect points of those? Any feedback, not to mention an actual solution, would be greatly appreciated. The code below should be ready to display instantly once added to an empty GameObject in Unity in case that helps. If I can just get the points, I can work on the custom mesh rendering myself. The second image illustrates the actual information I'm trying to get.

find perpindicular vector 2d

Then I can get the points to use in the drawing api. They just need to be rotated 90 degrees to give me D1 and D2. I can get points C1 and C2 that are an arbitrary distance (thickness) out from the point of impact. You can see the blue line which is so close to what I want. I've included an image from in Unity showing what I can get. My math, vector, and trigonometry skills are just not up to this challenge.

#FIND PERPINDICULAR VECTOR 2D HOW TO#

However, it's not working and I don't understand matrix math or Vector API's enough to figure out how to rotate my points, etc.

find perpindicular vector 2d find perpindicular vector 2d

I worked out the code below according to the post here: cross-direction-for-3-points.html What I want is the vector perpendicular to that side. In other words, with 3 points, I can get the vector for the line that represents the side of a billiard ball table assuming the middle point is the point of impact with the side of the table. The closest I've come is figuring out points along the line perpendicular to the one I want.















Find perpindicular vector 2d