![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <3d49ebcf$1@news.povray.org>,
"Vash" <gra### [at] telusplanet net> 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] mac com>
POV-Ray TAG e-mail: chr### [at] tag povray org
TAG web site: http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Fri, 02 Aug 2002 12:58:06 -0400, Dave Dunn <poi### [at] aol com> 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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <3D4ABA1E.533A0C06@aol.com>, Dave Dunn <poi### [at] aol com>
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] mac com>
POV-Ray TAG e-mail: chr### [at] tag povray org
TAG web site: http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <3D4AD28B.126EA1F3@aol.com>, Dave Dunn <poi### [at] aol com>
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] mac com>
POV-Ray TAG e-mail: chr### [at] tag povray org
TAG web site: http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Christopher James Huff wrote:
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 {...}
> }
Hey Chris, thanks for the tip. It is ridiculously simple when you look at
it. Hadn't even thought of that.
Dave
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> 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
The reasons for not including the torii's position in the first few
parameters have to do with the way torus intersections are calculated,
mathematically, at the lowest level. I believe that factoring in a
translation inside the *base* intersection calculation would make the
calculation slower. Translations, on the other hand, are a type of
transformations, which are applied *separately* from the base intersection
calculations, and are only applied when necessary.
Trust me, it makes sense when you work out the math yourself =)
- Slime
[ http://www.slimeland.com/ ]
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |