POV-Ray : Newsgroups : povray.advanced-users : Points on a curve Server Time
31 Oct 2024 23:27:40 EDT (-0400)
  Points on a curve (Message 1 to 2 of 2)  
From: tgl
Subject: Points on a curve
Date: 17 Oct 2010 20:40:00
Message: <web.4cbb96bf1eb12a3dd9c1e2f80@news.povray.org>
Hello friends
 Imagine this; a hollow torus with simple geometric shapes (Triangles,
circles...ect.) cut into or raised in relief from its surface. The question I
ask is how does one figure out the coordinates to create either clipped_by
objects, splines or prisms of the afore mentioned shapes that follow the curve
of the torus' minor radius?
 Hope this makes sense.
 Thanks


Post a reply to this message

From: Le Forgeron
Subject: Re: Points on a curve
Date: 18 Oct 2010 03:25:16
Message: <4cbbf65c$1@news.povray.org>
Le 18/10/2010 02:37, tgl a écrit :
>  Hello friends
>  Imagine this; a hollow torus with simple geometric shapes (Triangles,
> circles...ect.) cut into or raised in relief from its surface.

You mean intersecting  prism (linear_sweep or conic_sweep, it's up to
you), cylinder (or cone ?), etc... right ?

> The question I
> ask is how does one figure out the coordinates to create either clipped_by
> objects, splines or prisms of the afore mentioned shapes that follow the curve
> of the torus' minor radius?

You just don't. You use a CSG instead and voilà.

If you really need the coordinates, it's easy to know that the equation
of a torus is
 x = (R+r.cos(v)).cos(u)
 y = R.sin(v)
 z = (R+r.cos(v)).sin(u)

with u,v in [0,2.pi[

Then you have to compute the intersection... which usually ends up as an
additional equation between u & v, so that you keep only one moving
variable (either u or v, or maybe a predecessor like t with u=f(t) and
v=g(t)
)


For instance, if you want a crisps (br)/chips (us), you could go for

intersection {
  difference {
  torus { 4,1 }
  torus { 4,0.8 }   /* thickness = 0.2 */
  }
  cylinder { 4*x,4*x+1.2*y,0.7 }
}

>  Hope this makes sense.
>  Thanks
> 
> 
Of course, you put the cylinder/... wherever you want to match your circle.

Here a full illustration:



light_source {
  <10, 10, 10>      // position of the light source
  color rgb 1.0     // color of the light

}
#default{ finish {ambient 1.0 }  }

#include "finish.inc"


intersection {
  difference {
  torus { 4,1 }
  torus { 4,0.8 }   /* thickness = 0.2 */
  }
  cylinder { 4*x,4*x+1.2*y,0.7 }
  texture { pigment { color rgb <1,0.5,1> }
  finish { Dull }
  }
}

      // perspective (default) camera
camera {
  location  <0.0, 7.0, -0.0>
  look_at   <4.0, 0.0,  0.0>
  right     x*image_width/image_height
}



-- 
A: Because it messes up the order in which people normally read text.<br/>
Q: Why is it such a bad thing?<br/>
A: Top-posting.<br/>
Q: What is the most annoying thing on usenet and in e-mail?


Post a reply to this message

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