









 
 




 
 


I am working on a converter that converts the BRLCAD's objects in our POVray
format. I am able to convert sphere object of BRLCAD into POVray's.
Now, in torus
BRLCAD 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
BRLCAD, using normal to torus we can align/rotate torus, is there any way to
make torus using normal in POVray? There is a rotation macro used to rotate it
but I want to use normal vector as it is.
In brlcad normal vector 1 0 0 makes a torus parellel to y axis. How can I do the
same?
Smile On!
Gurwinder Singh
Post a reply to this message


 
 




 
 


Am 28.08.2014 04:49, schrieb bakom:
> I am working on a converter that converts the BRLCAD's objects in our POVray
> format. I am able to convert sphere object of BRLCAD into POVray's.
> Now, in torus
> BRLCAD 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
> BRLCAD, using normal to torus we can align/rotate torus, is there any way to
> make torus using normal in POVray? 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.
Post a reply to this message


 
 




 
 


clipka <ano### [at] anonymousorg> wrote:
> Am 28.08.2014 04:49, schrieb bakom:
> > I am working on a converter that converts the BRLCAD's objects in our POVray
> > format. I am able to convert sphere object of BRLCAD into POVray's.
> > Now, in torus
> > BRLCAD 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
> > BRLCAD, using normal to torus we can align/rotate torus, is there any way to
> > make torus using normal in POVray? 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/POVRay/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 POVray?(general
question).
Post a reply to this message


 
 




 
 


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 BRLCAD's objects in our POVray
>>> format. I am able to convert sphere object of BRLCAD into POVray's.
>>> Now, in torus
>>> BRLCAD 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
>>> BRLCAD, using normal to torus we can align/rotate torus, is there any way to
>>> make torus using normal in POVray? 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/POVRay/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 POVray?(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 illbalanced in regard to opening and closing braces.

Just because nobody complains does not mean all parachutes are perfect.
Post a reply to this message


 
 




 
 


Am 12.09.2014 06:45, schrieb bakom:
> clipka <ano### [at] anonymousorg> wrote:
>> Am 28.08.2014 04:49, schrieb bakom:
>>> I am working on a converter that converts the BRLCAD's objects in our POVray
>>> format. I am able to convert sphere object of BRLCAD into POVray's.
>>> Now, in torus
>>> BRLCAD 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
>>> BRLCAD, using normal to torus we can align/rotate torus, is there any way to
>>> make torus using normal in POVray? 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/POVRay/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?
No; the "normal vector calculation" in there computes the "surface
normal" for a given point, not the normal vector of the plane on which
the torus lies.
> If plane is formed by using normal so why not torus in POVray?(general
> question).
The mathematical formula for computing the intersection of a ray with a
torus is complicated enough as it is, so this is simply how the torus
object is implemented.
Theoretically it would be possible to allow for a vector to be
specified, and automatically convert that into a corresponding rotation
matrix; however, that would have to be done in the parser, which is ugly
and kludgy enough already, so we try to avoid changes in there.
Post a reply to this message


 
 




 
 


Le_Forgeron <lef### [at] freefr> wrote:
> Le 12/09/2014 06:45, bakom a Ã©crit :
> > clipka <ano### [at] anonymousorg> wrote:
<snip>
> 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.
Thanks a lot for this. Very helpful to me.
So, I can make a macro for azimuth and elevation?
I am trying to write a macro in which I rotate the camera by using rotation as
#macro Set_Camera_rotation { <angle>}.
But need some more knowledge for making this.
Post a reply to this message


 
 




 
 


"bakom" <gswithbains> wrote:
> Le_Forgeron <lef### [at] freefr> wrote:
> > Le 12/09/2014 06:45, bakom a Ã©crit :
> > > clipka <ano### [at] anonymousorg> wrote:
>
> <snip>
>
> > 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.
>
> Thanks a lot for this. Very helpful to me.
> So, I can make a macro for azimuth and elevation?
> I am trying to write a macro in which I rotate the camera by using rotation as
> #macro Set_Camera_rotation { <angle>}.
> But need some more knowledge for making this.
How to write it?
Post a reply to this message


 
 




 

