# Drawing a Quad Polygon strating from a 3d Line entity.

I need to draw a Quad shape starting from a Line expressed in 3d points structure data (x,y,z).
I need to find the normals of the line ( with an angle of 90.0 degrees), and intersect them with a given height. In this way i could find the other 2 vertices and able to draw the quad. I will use this procedure to find the trajectory of a circular Blade, cutting a solid.

Is there some experts that could help me?
###### Who is Participating?

Commented:
PAQed with points refunded (125)

modulo
Community Support Moderator
0

Author Commented:
Ive resolved the proble on my own, sorry for the inconvenience:

I proceed in this way:

I find the Alfa angle:

Alfa = atan(y2-y1/x2-x1)

Then i find the other two vertices of the quad.

x3 = x1 - r sin Alfa
y3 = y1 + r cos Alfa
x4 = x2 - r sin Alfa
y4 = y2 + r cos Alfa

0

Commented:
Are you trying to create a quad in a circle?

corey
0

Author Commented:
No, im building several circles rapresenting a blade track, with several polys that interpolate the circles. If there was a space for images on this site, i would be able to clarify me better.. sorry...
0

Commented:
You can do this without any trig, and without the risk of division-by-zero (if we can assume that x1 != x2 or y1 != y2).

dx = x2 - x1
dy = y2 - y1
scale = sqrt(dx*dx + dy*dy)/r
xoff = -scale*dy;
yoff = scale*dx;
x3 = x1 + xoff;
y3 = y1 + yoff;
x4 = x2 + xoff;
y4 = y2 + yoff;
0

Commented:
With points refunded?  Several people answered his question.
0

Commented:
"Ive resolved the proble on my own, sorry for the inconvenience:" and posting a solution right after this...two months before your answer. :)

It is a self answered question.

Venabili
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.