POV-Ray : Newsgroups : povray.programming : Making Torus : Re: Making Torus Server Time
16 Apr 2024 10:38:36 EDT (-0400)
  Re: Making Torus  
From: Le Forgeron
Date: 12 Sep 2014 02:45:36
Message: <54129690$1@news.povray.org>
Le 12/09/2014 06:45, bakom a écrit :
> clipka <ano### [at] anonymousorg> wrote:
>> Am 28.08.2014 04:49, schrieb bakom:
>>> I am working on a converter that converts the BRL-CAD's objects in our POV-ray
>>> format. I am able to convert sphere object of BRL-CAD into POV-ray's.
>>> Now, in torus
>>> BRL-CAD make a torus by using
>>> center point, normal vector, inner radius and outer radius.
>>> eg. Center : X Y Z
>>> Normal Vector: X Y Z
>>> Radius1: r1
>>> Radius2: r2
>>> I am able to convert it( by avoiding normal of brlcad's object ) but as in
>>> BRL-CAD, using normal to torus we can align/rotate torus, is there any way to
>>> make torus using normal in POV-ray? There is a rotation macro used to rotate it
>>> but I want to use normal vector as it is.
>>
>> Nope, you need to apply a rotation.
> 
> Ok, but in torus.cpp file
> https://github.com/POV-Ray/povray/blob/master/source/backend/shape/torus.cpp
> there is a normal vector calculation at line number 358. So can we use it in any
> way for making torus?
> If plane is formed by using normal so why not torus in POV-ray?(general
> question).

It seems that you are asking for something similar to mesh2 / mesh : a
different syntax for the same object.

Excepted that the parser does not have to be patched in your situation:
make a macro which will take your parameters and make the needed
transcriptions in the SDL as it is today.

it might be something like:

#include "transform.inc"
#macro TorusBRL(Center, Normal, Radius1, Radius2)
torus {
Radius1, Radius2 // at <0,0,0>, normal as y
Reorient_Trans(y, Normal) // still at <0,0,0>, normal as Normal
translate Center // now at the right place and orientation
}
#end

Then you need some trick like

object { TorusBRL(...) texture { pigment { color Yellow } finish {
Glossy } } }

to texture it.

Or you add a fifth parameter to the macro, to pass extra tokens ? (I
wonder if it works or not)
Or you make the macro ill-balanced in regard to opening and closing braces.

-- 
Just because nobody complains does not mean all parachutes are perfect.


Post a reply to this message

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