POV-Ray : Newsgroups : povray.general : Is it possible to move a torus? Server Time
18 Nov 2024 15:22:02 EST (-0500)
  Is it possible to move a torus? (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: Vash
Subject: Is it possible to move a torus?
Date: 1 Aug 2002 22:17:51
Message: <3d49ebcf$1@news.povray.org>
I want to specify the coordinates for a torus other than the origin.  Is
this possible, and if so, how can I do it?


Post a reply to this message

From: hughes b
Subject: Re: Is it possible to move a torus?
Date: 1 Aug 2002 23:13:54
Message: <3d49f8f2@news.povray.org>
"Vash" <gra### [at] telusplanetnet> wrote in message
news:3d49ebcf$1@news.povray.org...
> I want to specify the coordinates for a torus other than the origin.  Is
> this possible, and if so, how can I do it?

Wow, that sure is a povray.newusers group question if I ever saw one!
I'm just teasing. I'm going to answer like I'm talking to a child, if I can,
anyhow.
 :-)

Since the torus wants to begin at the origin, <0,0,0>, you need to add a
'translate' vector or axis. Only a size is given to begin with, but not a
location vector as is with sphere and many other primitives.

Order of things put in are typically done like:

torus {
    WheelSize, // main width in units
    TireSize // secondary width in units
scale <1,1,1> // initial resize and/or reshape
 rotate <360,360,360> // initial turning
  translate <1,2,3> // intial position
}
// (numbers can be whatever you want).

In this way you can resize then spin it around and finally place it. Of
course, other orders of the "transformations" (scale, rotate, translate) are
possible but this is how to manipulate the torus in the basic way.


Post a reply to this message

From: Christopher James Huff
Subject: Re: Is it possible to move a torus?
Date: 1 Aug 2002 23:48:10
Message: <chrishuff-2FEBF4.22392001082002@netplex.aussie.org>
In article <3d49ebcf$1@news.povray.org>,
 "Vash" <gra### [at] telusplanetnet> wrote:

> I want to specify the coordinates for a torus other than the origin.  Is
> this possible, and if so, how can I do it?

Look up the "translate" transform:

torus {1, 0.2
    ...textures, etc...
    translate NEW_CENTER_POSITION
}

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

From: Dave Dunn
Subject: Re: Is it possible to move a torus?
Date: 2 Aug 2002 12:28:36
Message: <3D4AB315.5D76F0DE@aol.com>
Christopher James Huff wrote:

> Look up the "translate" transform:

The other option, of course, would to be to write a macro called Torus that
lets you supply the start coordinates (yes, I know expressed as a
translation), and normal axis (a rotation), as well as the inner and outer
radii. Something like: Torus(Maj_Rad, Min_Rad, Location, Normal). As part of
an included file, this would make using torus a bit more intuitive, and in
keeping with the syntax of most other primitives.

Dave


Post a reply to this message

From: Dave Dunn
Subject: Re: Is it possible to move a torus?
Date: 2 Aug 2002 12:58:37
Message: <3D4ABA1E.533A0C06@aol.com>
This may be a bit much on this subject, but here is some code showing how a
Torus macro might work. I am not happy with having to declare the variables for
the normals outside the macro, but don't have time to really think about it
right now. The cleanest way would be to just remember that normal y is 0, x is 1
and z is 2, but I wanted a clearer version for this example.

#include "colors.inc"

camera { location  <0, 1, -10> look_at 0}

light_source {<5,10,-20> White}

// This would go in the include file
#declare Y=0;
#declare X=1;
#declare Z=2;

#macro Torus(Maj,Min,Nor,Loc)
torus {Maj,Min
#switch(Nor)
#case(0)
#break
#case(1)
rotate z*90
#case(2)
rotate x*-90
#end
translate Loc}
#end

//This would go in the scene file
object {Torus(3,.2,Y,<2,2,5>)
pigment {Red}}


Post a reply to this message

From: ABX
Subject: Re: Is it possible to move a torus?
Date: 2 Aug 2002 13:16:04
Message: <naflkugv9mcjq9somrc4tlirg5cq4vfgpd@4ax.com>
On Fri, 02 Aug 2002 12:58:06 -0400, Dave Dunn <poi### [at] aolcom> wrote:
> This may be a bit much on this subject, but here is some code showing ...

This could be extended with macro from standard includes to orient torus along
any direction. Don't remember its name ? Check names of all identifiers at
http://www.abx.art.pl/pov/bonus

ABX


Post a reply to this message

From: Christopher James Huff
Subject: Re: Is it possible to move a torus?
Date: 2 Aug 2002 14:09:27
Message: <chrishuff-D3AA17.13001402082002@netplex.aussie.org>
In article <3D4ABA1E.533A0C06@aol.com>, Dave Dunn <poi### [at] aolcom> 
wrote:

> This may be a bit much on this subject, but here is some code showing 
> how a Torus macro might work. I am not happy with having to declare 
> the variables for the normals outside the macro, but don't have time 
> to really think about it right now. The cleanest way would be to just 
> remember that normal y is 0, x is 1 and z is 2, but I wanted a 
> clearer version for this example.

You could have just used x, y, and z, though the logic for finding the 
axis would be a bit more complex. Best would be something like this, 
which can use any axis (rearranged the parameters to be more consistent 
with the built-in shapes):

#include "transforms.inc"
#macro Torus(Center, Axis, MajorRadius, MinorRadius)
    torus {MajorRadius, MinorRadius
        Point_At_Trans(Axis)
        translate Center
    }
#end

The "sturm" flag is a problem...you could either have this macro 
generate sturm or non-sturm torii, or you could add another parameter 
that will always have to be given because macros don't have default 
parameter values. You could just leave out the last } bracket, so the 
macro usage would be like:

Torus(< 0, 0, 0>, < 1, 2, 3>, 1, 0.2)
    sturm
    texture {...}
}

This would make it easier for other things, like textures, hollow and 
inverse, etc...you wouldn't have to wrap the macro call in an object {} 
block. Brackets don't match up though, which may annoy some people.

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

From: Dave Dunn
Subject: Re: Is it possible to move a torus?
Date: 2 Aug 2002 14:42:50
Message: <3D4AD28B.126EA1F3@aol.com>
Christopher James Huff wrote:

> You could have just used x, y, and z, though the logic for finding the
> axis would be a bit more complex. Best would be something like this,
> which can use any axis (rearranged the parameters to be more consistent
> with the built-in shapes):

You know, this is almost shaping up like an argument to modify the syntax
of the torus object. You would, of course have to still call the original
version by its name for backwards compatibility, but a torus2 object might
be nice to have. I have always thought that it was odd that torus was the
only primitive that could not be placed without a transformation anywhere
else than at the Origin.


Post a reply to this message

From: Christopher James Huff
Subject: Re: Is it possible to move a torus?
Date: 2 Aug 2002 15:52:52
Message: <chrishuff-332A02.14434002082002@netplex.aussie.org>
In article <3D4AD28B.126EA1F3@aol.com>, Dave Dunn <poi### [at] aolcom> 
wrote:

> You know, this is almost shaping up like an argument to modify the syntax
> of the torus object. You would, of course have to still call the original
> version by its name for backwards compatibility, but a torus2 object might
> be nice to have. I have always thought that it was odd that torus was the
> only primitive that could not be placed without a transformation anywhere
> else than at the Origin.

That would be strange, if it was true:

height_field
julia_fractal
lathe
sor
superellipsoid
text
poly
cubic
quartic
quadric

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

From: Dave Dunn
Subject: Re: Is it possible to move a torus?
Date: 2 Aug 2002 15:59:56
Message: <3D4AE49D.5A5093DE@aol.com>
Christopher James Huff wrote:

>
> That would be strange, if it was true:

Heh heh. I knew I should have qualified that and said basic primitives, in which
group I include torus. I was thinking, of course, of the following:

sphere
box
cylinder
cone
torus2  ; }


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

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