Link to home
Start Free TrialLog in
Avatar of Filae
Filae

asked on

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?
Avatar of Barca
Barca
Flag of Hong Kong image

Avatar of Filae
Filae

ASKER

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

r = radius of circular blade.
Are you trying to create a quad in a circle?

corey
Avatar of Filae

ASKER

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...
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;
With points refunded?  Several people answered his question.
I will guess you had simply missed this from the Asker
"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
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial