create and rotate a line up to a convex polygon vertex
Show older comments
Hello,
how can i create and rotate a line up to a convex polygon vertex ?
line is tangent to vertex and rotate the line by the smallest angle between the line and the segment following the vertex it passes through (in clockwise order.)
step1: create a convex polygon step2: find the leftmost point of the polygon step3:create a line that is tangent to the leftmost point of the polygon. step4:rotate the line by the smallest angle between the line and the segment following the vertex it passes through (in clockwise order.)
step 1,2 and 3 ok, but i have problems with step 4.
i have already tried
*angle = atan2(norm(cross(v1,v2)),dot(v1,v2));*
that method but when i find the direction of vector it equal to 0 0 0 .
please help me.
thanks
8 Comments
Sean de Wolski
on 29 Dec 2011
Can you provide a small set of sample data and maybe steps for creating a plot with a description of what you want?
dediydi
on 29 Dec 2011
Sean de Wolski
on 29 Dec 2011
But won't the left most point be a vertex and thus no tangent defined? Please clarify. Step 4 is not at all clear either. A picture would be worth a 1000 words. Could you draw a little sample image and post it to a free image hosting website?
dediydi
on 29 Dec 2011
Sean de Wolski
on 29 Dec 2011
Those lines are not tangents to the vertex (undefined); they're vertical lines at the vertex. So you want to calculate the angle between that vertical line and the two edges of the polygon touching that vertex?
Andrew Newell
on 29 Dec 2011
My interpretation of this procedure is that, after step 4, you will have a line that extends one of the edges of the polygon. Is that correct?
dediydi
on 29 Dec 2011
dediydi
on 29 Dec 2011
Accepted Answer
More Answers (1)
Categories
Find more on Elementary Polygons in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!