Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
trouble with rotating a cylinder
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
kedmond  
View profile  
 More options May 17 2009, 6:44 pm
Newsgroups: comp.graphics.rendering.renderman
From: kedmond <kedm...@gmail.com>
Date: Sun, 17 May 2009 15:44:19 -0700 (PDT)
Local: Sun, May 17 2009 6:44 pm
Subject: trouble with rotating a cylinder
I'm trying to write a program that will take two sets of coordinates
in space A = [x1, y1, z1] and B = [x2, y2, z2] and then draw a
cylinder between the two of them.

I am having a surprisingly hard time of expressing this calculation in
Renderman.

For example, I made a sphere that is at [0, 0, 0] and another at [1,
1, 1].

If a horizontal line were drawn through the [0, 0, 0] sphere and a
vector drawn to [1, 1, 1] then the angle would be around 35 degrees,
while the angle between the line and the x-axis is 45 degrees.

I guess I'm not sure how to make Renderman render this configuration.
I've tried the following:

TransformBegin
Rotate -35 1 0 0
Rotate -45 0 1 0
Rotate 0 0 0 1

Translate 0 0 0
Cylinder 0.2 0 5 360
TransformEnd

Of course, this does not work.  Any help would be greatly appreciated.

-Kazem


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
kedmond  
View profile  
 More options May 18 2009, 12:49 am
Newsgroups: comp.graphics.rendering.renderman
From: kedmond <kedm...@gmail.com>
Date: Sun, 17 May 2009 21:49:13 -0700 (PDT)
Local: Mon, May 18 2009 12:49 am
Subject: Re: trouble with rotating a cylinder
Nevermind!  I just found an online copy of Malcolm Kesson's 1994
introductory book on Renderman.  In it, he explains how the order of
the operations is crucial.  I had no idea Renderman computed the
transformations in reverse order from when the object is declared.  I
guess you'd call it a LiFo.

-kedmond

On May 17, 6:44 pm, kedmond <kedm...@gmail.com> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
olivier3...@hotmail.com  
View profile  
 More options May 21 2009, 9:26 am
Newsgroups: comp.graphics.rendering.renderman
From: Olivier3...@hotmail.com
Date: Thu, 21 May 2009 06:26:06 -0700 (PDT)
Local: Thurs, May 21 2009 9:26 am
Subject: Re: trouble with rotating a cylinder
On May 17, 6:44 pm, kedmond <kedm...@gmail.com> wrote:

> I'm trying to write a program that will take two sets of coordinates
> in space A = [x1, y1, z1] and B = [x2, y2, z2] and then draw a
> cylinder between the two of them.

By the way, the best method to do that is not with rotations but with
a change of basis. Compute the following vectors:

Z = (B - A)
Y = any vector which is perpendicular to Z
X = Y x Z (cross product)

then normalize X and Y (to not change the radius of your cylinder) and
build a transformation matrix using the 3 vectors as rows (or columns,
depending which way the matrices are used). I assumed here that the
original cylinder had its length along the Z axis. If not, you need to
swap the vectors.

To pick a vector V which is perpendicular to W, use:
V = (0, Wz, -Wy)    if |Wx| < |Wy|
V = (-Wz, 0, Wx)    otherwise

You can easily verify that V.W (the dot product) is always zero. The
two cases are so V is never (0,0,0) if W isn't.

Olivier


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google