POV-Ray : Newsgroups : povray.general : A Question.. : Re: A Question.. Server Time
7 Aug 2024 09:21:47 EDT (-0400)
  Re: A Question..  
From: Chris Colefax
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.