POV-Ray : Newsgroups : povray.general : Sphere sweep along the surface of a sphere : Re: Sphere sweep along the surface of a sphere Server Time
31 Jul 2024 14:33:51 EDT (-0400)
  Re: Sphere sweep along the surface of a sphere  
From: Tim Attwood
Date: 26 Jan 2007 16:05:59
Message: <45ba6d37$1@news.povray.org>
> Thanks for the idea... I managed to figure out a way to do it (hopefully
> somebody else will find this useful): basically I draw the shape of the
> eyelids on a flat plane (XY plane), which I use to make a prism for 
> cutting
> out the sphere that covers the eyeball, thus making the eyehole of the
> desired shape. Since the resulting hole is essentially the (parallel)
> projection of the flat shape onto the sphere, I just use a little math:
> (x,y) gets mapped to (x,y,sqrt(1-x*x-y*y)), assuming that the curve
> lies within the unit circle and the sphere to be cut from is also a unit
> sphere. I use this formula to map the control points of the curve onto
> the sphere, and then use the results to make the sphere_sweep that
> describes the eyelids.

(see 3.2.1.4.5  Functions, trace)
Trace perty much would do the same thing, transfer a
point on the imaginary XY plane to your object surface.

Trace however doesn't require you know the formula
for the surface of the object you want to find a point on,
so if you have a more complicated shape it could still
work for that.

Also, trace can return the normal of the surface, you could
use that to place the base of objects in relation to the
surface, IE eyelashes, or fur.

#include "transforms.inc"
#declare EyeLid = ...
#declare EyeLash = ...

#declare Norm = <0,0,0>;
#declare direction = z; // into the scene
#declare hit = trace(EyeLid, XYpoint, direction, Norm);
#if (vlength(Norm)=0) #error "Trace missed object." #end

object { EyeLash
   Point_At_Trans(Norm)
   translate hit
   pigment{...}
}


Post a reply to this message

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