POV-Ray : Newsgroups : povray.newusers : CSG Problems in drawing Arc Server Time
2 Jun 2024 13:17:51 EDT (-0400)
  CSG Problems in drawing Arc (Message 3 to 12 of 12)  
<<< Previous 2 Messages Goto Initial 10 Messages
From: B  Gimeno
Subject: Re: CSG Problems in drawing Arc
Date: 11 Oct 2012 14:25:01
Message: <web.50770e791ba8ef45ae2fd8290@news.povray.org>
"Eugene.K" <eug### [at] gmailcom> wrote:
>      #local  oRad = rad(oArc/2) ;

.... among other things I'm not sure to understand... What says your manual about
the reserved word "rad"? Or is a macro written for you to pass degrees to
radians? In your published code the statements of some predefined variables
shine in his absence.

You should also read the manual about the macro "Wedge (Angle)" included in
"shapes.inc" that approaches to what you want.

Furthermore, pov-ray like any other computer program does exactly what you ask
him to do the way that you ask it ;-)


B. Gimeno


Post a reply to this message

From: Christian Froeschlin
Subject: Re: CSG Problems in drawing Arc
Date: 11 Oct 2012 15:53:22
Message: <507723b2@news.povray.org>
Eugene.K wrote:

> BUT --  CSG still does not work; we get two lit pixels at the intersection
> of torus and cone boundary, indicating two points of intersection,
> but that's it!

this would be easier if you post a self-contained sample scene
(e.g. with torus_z) that other people can render for themselves.

CSG usually works pretty well. Most problems come from coincident
surfaces or not realizing that you intersect volumes, not surfaces.

Note there is also a "radians" function in functions.inc.

PS: Somehow you managed to format SDL to look like assembler to me ;)


Post a reply to this message

From: Eugene K
Subject: Re: CSG Problems in drawing Arc
Date: 17 Oct 2012 01:25:07
Message: <web.507e40ab1ba8ef451d9406540@news.povray.org>
"B. Gimeno" <nomail@nomail> wrote:
> "Eugene.K" <eug### [at] gmailcom> wrote:
> >      #local  oRad = rad(oArc/2) ;
>
> .... among other things I'm not sure to understand... What says your manual about
> the reserved word "rad"? Or is a macro written for you to pass degrees to
> radians? In your published code the statements of some predefined variables
> shine in his absence.
>
> You should also read the manual about the macro "Wedge (Angle)" included in
> "shapes.inc" that approaches to what you want.
>
> Furthermore, pov-ray like any other computer program does exactly what you ask
> him to do the way that you ask it ;-)
>
>
> B. Gimeno

Thank you for your response!

//=============================================
// ARC RADIANS TO AND FROM DEGREES
// short-named for tidy trig formulae
// --------------------------------------------
   #declare  deg_rad = 180/pi ;//=(57.2957795-)
// --------
     #macro  deg(oRad)  (oRad * deg_rad)   #end
     #macro  rad(oDeg)  (oDeg / deg_rad)   #end
//=============================================
....is part of 'Core', my personal constants package;
I'd much rather write "sin(rad(oDeg))" than
"sin(radians(oDeg))", especially in tight places,
and no one else yet was using that symbol, so...?

I would like to share such packages, but don't know how yet.

I looked into 'shapes.inc' and found 'Wedge( )', which does use
at least relevant technique...thank you!

Eugene.K


Post a reply to this message

From: Eugene K
Subject: Re: CSG Problems in drawing Arc
Date: 17 Oct 2012 02:00:19
Message: <web.507e46ec1ba8ef451d9406540@news.povray.org>
Christian Froeschlin <chr### [at] chrfrde> wrote:
> Eugene.K wrote:
>
> > BUT --  CSG still does not work; we get two lit pixels at the intersection
> > of torus and cone boundary, indicating two points of intersection,
> > but that's it!
>
> this would be easier if you post a self-contained sample scene
> (e.g. with torus_z) that other people can render for themselves.
>
> CSG usually works pretty well. Most problems come from coincident
> surfaces or not realizing that you intersect volumes, not surfaces.
>
> Note there is also a "radians" function in functions.inc.
>
> PS: Somehow you managed to format SDL to look like assembler to me ;)

Thank you for suggestions.
My posts have been hasty, but as first ones
at least got me out into POV_Ray community.
Self-contained scene files will be a necessity for good sharing,
although my own reference several .txt-include modules.
Still whittling things down to where I have 'breadboard' scene files.

Yes, it has seemed unclear whether CSG cone{ (open?)}
has inside or not (need vector?), same for cylinder{ (open?)}
I think I need more practice of use.

I need do some more study on what is 'cone', though - got some stuff
in Oakley's 'Analytic Geometry' page 200, plus study POV implementation.

Yes, I'd much rather write "sin(rad(oDeg))" than "sin(radians(oDeg))",
especially in tight places, and symbol not yet used, so:
//=============================================
// ARC RADIANS TO AND FROM DEGREES
// short-named for tidy trig formulae
// --------------------------------------------
   #declare  deg_rad = 180/pi ;//=(57.2957795-)
// --------
     #macro  deg(oRad)  (oRad * deg_rad)   #end
     #macro  rad(oDeg)  (oDeg / deg_rad)   #end
//=============================================
......from my 'Core' custom symbols package.

Eugene.K


Post a reply to this message

From: Cousin Ricky
Subject: Re: CSG Problems in drawing Arc
Date: 24 Oct 2012 12:00:01
Message: <web.50880fa91ba8ef4578641e0c0@news.povray.org>
"Eugene.K" <eug### [at] gmailcom> wrote:
>
> //=============================================
> // ARC RADIANS TO AND FROM DEGREES
> // short-named for tidy trig formulae
> // --------------------------------------------
>    #declare  deg_rad = 180/pi ;//=(57.2957795-)
> // --------
>      #macro  deg(oRad)  (oRad * deg_rad)   #end
>      #macro  rad(oDeg)  (oDeg / deg_rad)   #end
> //=============================================
> ....is part of 'Core', my personal constants package;
> I'd much rather write "sin(rad(oDeg))" than
> "sin(radians(oDeg))", especially in tight places,
> and no one else yet was using that symbol, so...?

"Yet" is the key word.  POV-Ray reserves all-lowercase identifiers for possible
future use, although this rule is not enforced.  I suggest you change rad to Rad
and deg to Deg.


Post a reply to this message

From: B  Gimeno
Subject: Re: CSG Problems in drawing Arc
Date: 24 Oct 2012 15:10:01
Message: <web.50883cae1ba8ef45ae2fd8290@news.povray.org>
The "math.inc" standard include file provides a way for working with
trigonometric functions easilly.
Instead: sin(radians(X)), cos(radians(X)), etc...
Use: sind(X) or cosd() or tand() which works directly in *d*egrees.

B.Gimeno


Post a reply to this message

From: Eugene K
Subject: Re: CSG Problems in drawing Arc
Date: 20 Nov 2012 13:50:00
Message: <web.50abcfb21ba8ef45479850f0@news.povray.org>
Christian Froeschlin <chr### [at] chrfrde> wrote:
> Eugene.K wrote:
>
> > BUT --  CSG still does not work; we get two lit pixels at the intersection
> > of torus and cone boundary, indicating two points of intersection,
> > but that's it!
>
> this would be easier if you post a self-contained sample scene
> (e.g. with torus_z) that other people can render for themselves.
>
> CSG usually works pretty well. Most problems come from coincident
> surfaces or not realizing that you intersect volumes, not surfaces.
>
> Note there is also a "radians" function in functions.inc.
>
> PS: Somehow you managed to format SDL to look like assembler to me ;)

Thank you for that encouragement! Sorry such long time to get back to you
 - felt need to keep digging until I got to bottom of it then wright some
bytes for complete disclosure satisfaction. Result is an 'executable'
package of four functions which is set to display the answer to my initial
arc-drawing problem. There is also some more exploratory CSG.

Problem with this is that it's more than a little bit lengthy. For now,
I will simply append the entire text to paste into a '.pov' file.
I actually have entire packages I have been working up to share,
and know not how "publish" to POV-Ray community, perhaps you could help
me with this!? - or I'll just open another topic.
You are welcome to contact me at "eug### [at] gmailcom" so I can
return you a copy as Attachment, or for any other reason.

Anyway, here comes the File! - may you have fun playing with it!
Eugene

//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//    #file "arctor.demo.CB18.0200" //POV-Ray File
// #whatsit "DrawRing Arcs, Circs, and Spheres"

//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//=================================================
   #version 3.6 ;
   #global_settings{ ambient_light rgb<1,1,1>/1.0 }
//
   background{ rgb<1,1,1>/2.5 }
//
   light_source{ <+1,+1,-3>*10  rgb<1,1,1>/1.0 }
//
   camera{ perspective
                 angle (360/pi)*atan(1/2) / 1.0
              location < -3/5, +2/5, -1   > * 4.0
               look_at < +0  , +0  , +0   > * 1.0 }
//=================================================
// sphere{<0,0,0>,1 texture{pigment{rgb<0,1,1>/2.0}}}  //TEST
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   #if( 1 )  object{  //TEST->  Opr Enab 'texture' at }#end
// ----------------------------------------------------------
   #declare   dThin =   0.000001 ;// ~ 0{:lnth} marginal use
   #declare  RolClk = < 0, 0,-1> ;//(+y1 around z toward +x1)
   #declare      p0 = < 0, 0, 0> ;
     #macro  rad(oDeg) (oDeg*pi/180)  #end
     #macro  deg(oRad) (oRad*180/pi)  #end
     #macro    sign(A) (1-2*(A<0))    #end
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

//===========================================================
// SQUARE CROSS-SECTION TOROID AROUND 'Z'
// replaces 4th order quartic polynomial
// rP = toroid major +radius
// rQ = toroid minor +radius = square x-sect side length/2
// ----------------------------------------------------------
     #macro  torcyl_z(rP,rQ) //cylindric toroid of plane(y,x)
// --------  ------------------------------------------------
   difference { // pA                  pB               rQ
   cylinder { <0, 0, -rQ      > , <0, 0, +rQ      > , rP+rQ }
   cylinder { <0, 0, -rQ-dThin> , <0, 0, +rQ+dThin> , rP-rQ }
              }                                          #end
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//          (  rP    rQ  )
// torcyl_z ( 1.00, 0.10 )  //<-TEST
//===========================================================
//
//==============================================
   #macro  // cone to contain hemisphere

           //"cone{pA,rA,pB,rB}"
// --------  -----------------------------------



           )
// --------  -----------------------------------
     #local  oArc = mod(abs(oApt),360+dThin)/2 ;
   #if     ( oArc < 89.99 ) //:deg
   cone { p0, 0    //null base at pA=p0, rA=0
        ,    (rSph * oOri)             //pB
        , abs(rSph)* tan(rad(oArc))    //rB
        }
   #else   //at 89.99:deg, rB=5730*rSph:lnth
   cylinder{ p0, (oOri*rSph), abs(rSph) }//limit
   #end                                     #end
//::::::::::::::::::::::::::::::::::::::::::::::
//          ( oOri  rSph  oApt )
//  hemicon ( +1*y, +1.0, +090 )  //<-TEST
//==============================================
// +
//==============================================
   #macro   //sphere contained by cone
// --------  -----------------------------------



           )
// --------  -----------------------------------
     #local  oArc = mod(abs(oApt),360+dThin) ;
   union  {
// --------  -----------------------------------
   intersection {     // (oArc <= 180)//:deg
     sphere {p0,abs(rSph)}
    hemicon (+oOri,+rSph,+oArc)
                }
// --------  -----------------------------------
        #if              (oArc  > 180)//:deg
   difference {
     sphere {p0,abs(rSph)}
    hemicon (-oOri,+rSph,-oArc+360)
              }
// --------
      #else  sphere{p0,0}               #end//if
// --------  -----------------------------------
          }                                 #end
//::::::::::::::::::::::::::::::::::::::::::::::
//         ( oOri  rSph  oApt )
//  sphcon ( +1*y, +1.0, +090 )  //<-TEST
//==============================================
//
//===========================================================
// SQUARE CROSS-SECTION ARC AROUND AXIS 'Z'
// ----------------------------------------------------------


//                               both < 0 recipro complement

// rWir : +lnth = minor radius = square x-sect side length/2
// ----------------------------------------------------------
     #macro  arctor_z(rArc,oArc,oClk,rWir)
// --------  ------------------------------------------------
     #local  oRad = rad(mod(oArc,360+dThin))/2 ;
   union                          {
// ------------
   intersection          {//half to the right...
      torcyl_z(abs(rArc),rWir)
      plane { sign(rArc)*< +cos(+oRad), -sin(+oRad), 0 >, 0 }
      plane { -1*x, 0 }  }
// ------------
   intersection          {//and half to the left
      torcyl_z(abs(rArc),rWir)
      plane { sign(rArc)*< -cos(-oRad), +sin(-oRad), 0 >, 0 }
      plane { +1*x, 0 }  }
// --------
   rotate   +oClk*RolClk          }                      #end
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//          ( rArc  oArc  oClk  rWir )
   arctor_z ( +1.0, +240, +000, 0.02 )  //<-TEST
//===========================================================
//
//===================================================
// SQUARE CROSS-SECTION 'CIRC' OF PLANE(Y,X)
// w:'curvature' = 1 / r:'radius of curvature'
// --------------------------------------------------


//                           both < 0 recipro complmt

// rWir : +lnth     = square side length/2
// --------------------------------------------------
     #macro  circtor_z(wArc,sArc,oRol,rWir)
     object                                  {
// --------  ----------------------------------------
        #if  (abs(wArc) < 0.01 ) //:(deg/lnth)
// at 0.01:deg, rArc=5730*sArc:lnth, limit -> 'line'
   cylinder{ <-sArc/2,0,0> , <+sArc/2,0,0> , rWir }
// --------  ----------------------------------------

     #local  oArc = abs(deg(sArc*rad(wArc)));// o=s/r
     #local  rArc = sArc/rad(oArc)          ;// r=s/o
// --------  ----------------------------------------
        #if  (abs(oArc)  < 360 )//:deg
     object                       {
   arctor_z (+rArc,-sign(wArc)*oArc,+000,rWir)
  translate  +rArc *sign(wArc)*y  }
// --------  ----------------------------------------
      #else//(abs(oArc) >= 360 )//:deg
     object                      {
   torcyl_z  (abs(rArc),rWir)//shrinks w incr 'Omega'
  translate  +rArc*sign(wArc)*y  }
// --------  ----------------------------------------
       #end  #end//0.01
     rotate  +oRol*RolClk                    }   #end
//:::::::::::::::::::::::::::::::::::::::::::::::::::
//           ( wArc   sArc  oRol  rWir )
// circtor_z ( +090, +2.00, +000, 0.02 )  //<-TEST
//===================================================

//:::::::::::::::::::::::::::::::::::::::::::::::::::
//->TEST End Object
    texture {pigment{rgb<0,1,1>/1.3}}  }#end//objTEST
//:::::::::::::::::::::::::::::::::::::::::::::::::::
//     #eof "arctor.demo"


Post a reply to this message

From: Christian Froeschlin
Subject: Re: CSG Problems in drawing Arc
Date: 20 Nov 2012 18:24:33
Message: <50ac1131$1@news.povray.org>
Eugene.K wrote:

> Problem with this is that it's more than a little bit lengthy. For now,
> I will simply append the entire text to paste into a '.pov' file.
> I actually have entire packages I have been working up to share,
> and know not how "publish" to POV-Ray community, perhaps you could help
> me with this!?

you can "publish" by posting with attached text files to p.t.scene-files
or with an attached zip file to p.b.scene-files. For resuable objects
you can also have a look at http://objects.povworld.org


Post a reply to this message

From: Eugene K
Subject: Re: CSG Problems in drawing Arc
Date: 21 Nov 2012 23:10:01
Message: <web.50ada4da1ba8ef45479850f0@news.povray.org>
Christian Froeschlin <chr### [at] chrfrde> wrote:
> Eugene.K wrote:
>
> > Problem with this is that it's more than a little bit lengthy. For now,
> > I will simply append the entire text to paste into a '.pov' file.
> > I actually have entire packages I have been working up to share,
> > and know not how "publish" to POV-Ray community, perhaps you could help
> > me with this!?
>
> you can "publish" by posting with attached text files to p.t.scene-files
> or with an attached zip file to p.b.scene-files. For resuable objects
> you can also have a look at http://objects.povworld.org

Thank you for some nice forward pointers! The Object Collexion (been
around some time, hasn't it?!) looks good for approach, and I downloaded
some interesting objects, but I don't know how to access 'p.t.scene-files'
yet - tried Google it but naught conclusive.
Maybe find out by continuing relaxed exploration, with help always welcome.

Eugene.K


Post a reply to this message

From: Thomas de Groot
Subject: Re: CSG Problems in drawing Arc
Date: 22 Nov 2012 04:59:30
Message: <50adf782$1@news.povray.org>
On 22-11-2012 5:09, Eugene.K wrote:
but I don't know how to access 'p.t.scene-files'
> yet - tried Google it but naught conclusive.
> Maybe find out by continuing relaxed exploration, with help always welcome.

povray.text.scene-files is one of the newsgroups under POV-Ray, if you 
use newsgroups in any news reader like in Internet Explorer or 
Thunderbird. Otherwise you can access it throught the POV-Ray site: 
http://news.povray.org/groups/  and look under Pov-Ray Text Files.

Thomas


Post a reply to this message

<<< Previous 2 Messages Goto Initial 10 Messages

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