To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cadOpen lugnet.cad in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / 2990
2989  |  2991
Subject: 
Re: 3D geometry question
Newsgroups: 
lugnet.cad
Date: 
Wed, 13 Oct 1999 21:24:55 GMT
Viewed: 
566 times
  
Fredrik Glöckner skrev i meddelandet ...
Hi, I have this problem I hope someone may solve.

Say I have a vector v with length normalized to 1.  For simplicity,
picture this vector as starting in the origin.  Now, I need a
rotation matrix M with the following properties:

o  If I rotate a part with one edge going from (0,0,0) to (0,-1,0)
(i.e., pointing upwards), this edge should coincide with the vector v
after the transformation

o  M should be a proper transformation, i.e., no scaling or shearing.

Thanks for any help!

What about:

Assume V = (Vx, Vy, Vz)

B = arctan(Vx/Vz)
(Better with arctan2(Vz, Vx) if available, otherwise you have to adjust to the
right quadrant manually)

Matrix for rotation around Y:

(  cos(B) 0 sin(B) )
(    0    1   0    )
( -sin(B) 0 cos(B) )

Now transform V with this matrix, giving V'

A = arctan(V'y/V'z)

Matrix for rotation around X:
( 1    0      0    )
( 0  cos(A) sin(A) )
( 0 -sin(A) cos(A) )

Now multiply the two matrices, to get your final result.


(I checked with Excel, and it seems to work)
--
Anders Isaksson, Sweden
BlockCAD:  http://user.tninet.se/~hbh828t/proglego.htm
Gallery:   http://user.tninet.se/~hbh828t/gallery.htm



Message has 1 Reply:
  Re: 3D geometry question
 
Sorry, I just found out that I solved for (0,0,-1), not (0,-1,0), but that's just a symmetry change :-)) -- Anders Isaksson, Sweden BlockCAD: (2 URLs) (25 years ago, 13-Oct-99, to lugnet.cad)

Message is in Reply To:
  3D geometry question
 
Hi, I have this problem I hope someone may solve. Say I have a vector v with length normalized to 1. For simplicity, picture this vector as starting in the origin. Now, I need a rotation matrix M with the following properties: o If I rotate a part (...) (25 years ago, 13-Oct-99, to lugnet.cad)

7 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR