POV-Ray : Newsgroups : povray.general : A Question.. Server Time
20 Nov 2024 04:12:07 EST (-0500)
  A Question.. (Message 1 to 3 of 3)  
From: Jason M 
Subject: A Question..
Date: 14 Oct 2001 20:42:34
Message: <3bca30fa@news.povray.org>
I have a question that I've been attempting to figure out, or at least
if it's possible, for awhile now. I'm using an include file called
bend.inc (Made by Chris Colefax?) and would like to know the following.
After I bend an object, for example a plain cylinder, how would I go
about finding where the new end of it is? I don't know much how else to
describe it, I hope you understand..


Post a reply to this message

From: Ruy
Subject: Re: A Question..
Date: 16 Oct 2001 20:20:11
Message: <3bcccebb@news.povray.org>
"Jason M." <jas### [at] hotmailcom> escreveu na mensagem
news:3bca30fa@news.povray.org...
> I have a question that I've been attempting to figure out, or at least
> if it's possible, for awhile now. I'm using an include file called
> bend.inc (Made by Chris Colefax?) and would like to know the following.
> After I bend an object, for example a plain cylinder, how would I go
> about finding where the new end of it is? I don't know much how else to
> describe it, I hope you understand..

Some disclaimers:
1 - My math skills are admitedly poor, so this may not be the shortest
answer, albeit a precise one;
2 - English is not my primary language, so I don't know for sure if I
understood your question, nor if I will make my answer understandable;

That put, here it goes. Please refer to the picture I have posted at p.b.i
so you can have a visual of the explanation.

Suppose your cylinder is sitting along the x axis, with its fixed point
being the right extremity (object_axis1) and the left extremity being at <L,
0, 0> (object_Axis2). The length of your cylinder, therefore, is L.

Suppose you bend it by "alpha" degrees (or radians, for that matter). L will
then be an arch of a circumference with radius R, which can be defined as:

     R=l/alpha

From there, it's simple trig, and I believe the picture will explain better
than my cumbersome words.

Ruy


Post a reply to this message

From: Chris Colefax
Subject: Re: A Question..
Date: 18 Oct 2001 10:38:21
Message: <3bcee95d@news.povray.org>
Jason M. <jas### [at] hotmailcom> wrote:
> I have a question that I've been attempting to figure out, or at least
> if it's possible, for awhile now. I'm using an include file called
> bend.inc (Made by Chris Colefax?) and would like to know the following.
> After I bend an object, for example a plain cylinder, how would I go
> about finding where the new end of it is? I don't know much how else to
> describe it, I hope you understand..

Given the same parameters the end of a bent object always ends up at the
same point, so it's certainly possible to calculate the exact position.
Internally the include file applies a series of transformations (translates
and rotates) to achieve the bending of the object, and if you duplicate
these transformations on the end-point vector you can calculate the new
location.

Duplicating the transformations is the tricky part - one possibility is to
use POV 3.5 as follows (after including bend.inc):

#include "transforms.inc"
#declare NewEnd = vtransform(object_axis2, transform {
   transform _BN_basetransform translate -(y * _BN_oheight)
   translate -z * _BN_radius rotate x * _BN_angle
   translate z * _BN_radius rotate y * _BN_ospin rotate x * _BN_rotx
   rotate y * _BN_roty translate _BN_obase
   })


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.