POV-Ray : Newsgroups : povray.general : Rotations... : Re: Rotations... Server Time
7 Aug 2024 17:28:52 EDT (-0400)
  Re: Rotations...  
From: Margus Ramst
Date: 7 Aug 2001 05:30:48
Message: <3B6F8B2E.F2056CFD@peak.edu.ee>
Ben Chambers wrote:
> 
> Hmm... neat, but I can't seem to make it work...
> Ok, I have here an object:
> 
> sphere {
>  0,1
>  scale <5,1,5>
> }
> 
> I also have three points on a plane (lets call them
> p1,p2,p3).  I'd like to have this flattened sphere
> oriented on the plane...  Maybe I'm just braindead
> tonight, but the reorient macro didn't do it for
> me...
> 

If the plane is described by 3 points, you first need the normal vector
of the plane:

Normal=vnormalize(vcross(p2-p1,p3-p1))

and the distance along that normal:

Distance=vdot(p1,Normal)

Now to align your flattened sphere with the plane, using the Reorient
macro:

sphere{
  0,1
  scale <5,1,5>
  Reorient(y,Normal)
  translate Normal*Distance
}

This is untested, but as far as I can see, should work.

-- 
Margus Ramst

Personal e-mail: mar### [at] peakeduee
TAG (Team Assistance Group) e-mail: mar### [at] tagpovrayorg
Home page http://www.hot.ee/margusrt


Post a reply to this message

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