POV-Ray : Newsgroups : povray.binaries.images : sphere_sweep object trace : Re: sphere_sweep object trace Server Time
30 Jul 2024 12:28:30 EDT (-0400)
  Re: sphere_sweep object trace  
From: Samuel Benge
Date: 20 Oct 2011 15:05:01
Message: <web.4ea06ca731f7e1e6afac46ba0@news.povray.org>
"[GDS|Entropy]" <nomail@nomail> wrote:
> This is a first attempt at tracing an object with a sphere_sweep produced from a
> non-random cube point cloud. Obviously needs a bit of work before it will be
> useful for much.

Hey Ian!

It's turning out to be an interesting study, especially that third image. Could
we get a closeup on that?

> Not sure how to reorient_trans() just a vector, as I think that macro
> applies to objects.

You can transform vectors. Here's the way:

    #include "transforms.inc"

    // central reference
    sphere{0, 0.1 pigment{rgb x}}

    // the untransformed point
    #declare Pt = <0,1,0>;
    sphere{Pt, 0.1 pigment{rgb y}}

    // the transformed point
    #declare Pt = vtransform(Pt, transform{Reorient_Trans(<0,1,0>,<1,0,0>)});
    sphere{Pt, 0.1 pigment{rgb z}}

You can also align an object or vector with exact precision using this
transformation macro from Rune:

    #include "transforms.inc"

    // Rune's macro for aligning an object based on the y and z axes.
    #macro Z_Align( NormalVector, ZVector )
     #local ObjectZ = vnormalize( ZVector );
     #local ObjectY = VPerp_Adjust( NormalVector, ZVector );
     #local ObjectX = vcross( ObjectY, ObjectZ );
     transform{ Shear_Trans( ObjectX, ObjectY, ObjectZ ) }
    #end

The argument "NormalVector" is the direction the object's y-axis will be facing.
The argument "ZVector" is the direction the z-axis of the object will face; it
has a secondary influence over the final result.

As usual, these things parse more quickly when you don't have to include files.

> This image isn't particularly artistic, as I'm more interested in the logic of
> solving the problem than I am much else, so...yeah.

That's what POV-Ray is good for: everything ranging from artistic works to
scientific visualization :)

~Sam


Post a reply to this message

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