How to draw-project routes of lines on a plane after rotating them
1 view (last 30 days)
Show older comments
Hello, i try to to solve the problem mentioned below.
I have two lines which can be considered as the two sides a & b ( ---> /\ ) of a triangle (c is the base side). These lines are defined by (x, y) points in x-axis and y-axis. I want to perform some kind of rotation with specific theta (lets say, pi). Why i need to do this? All i want is to draw the "route" of the rotated lines so as to be designed the basis of a cone in a new plane (lets say z-axis). e.g: calipers writes on a piece of paper designing the basis of a cone.
Thanks in advance.
0 Comments
Answers (1)
Mike Garrity
on 9 Jul 2015
If the goal is just to draw the lines, then hgtransform is a good solution. You would do something like this:
g = hgtransform;
line([0 1],[0 0],'Parent',g,'Color','red')
line([0 sqrt(2)/2],[0 sqrt(2)/2],'Parent',g,'Color','blue')
Then you can rotate it like so:
g.Matrix = makehgtform('zrotate',pi/3);
The makehgtform command has a lot of options for different types of transformations, and it returns a matrix that you can use to transform the points of your lines yourself if you want to do more than just draw them. But the matrix is a 4x4. The idea is that you pad out the coordinates of your lines with 1's until it's a four element vector.
See Also
Categories
Find more on Object Containers in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!