POV-Ray : Newsgroups : povray.advanced-users : Orienting with multiple matrices Server Time
26 Nov 2024 01:39:55 EST (-0500)
  Orienting with multiple matrices (Message 1 to 4 of 4)  
From: Redbeard (MDJohnson)
Subject: Orienting with multiple matrices
Date: 7 Sep 2001 06:12:01
Message: <3b989d71@news.povray.org>
Hello all -

I am revisiting an include file tool I wrote ages ago for positioning
strings of objects.  I solved many of the problems I had with the original
using matricies (thanks to Jon VanSickle's Matrix page).  I have one left.

What I'm doing is creating multiple 'threads' from arbitrary objects to make
up a 'cord'.  There two user defined functions involved.  One generates the
path for the cord.  It takes T, the parameter for position in the cord, and
provides the vectors that make up a matrix: P0, X0, Y0, and Z0.  The second
generates an offset from the centerline of the cord for each individual
thread.  It works the same as the path, but takes a thread number and thread
count parameter and generates P1, X1, Y1, and Z1.  The sets of vectors are
combined into matrices M0 and M1 and then applied to the object with:

    #declare Xform = transform { transform { M1 } transform { M0 } }
    #declare Obj = object { Base transform Xform }
    // For later use:
    #declare Pt0 = vtransform(<0,0,0>, Xform);
    #declare Pt1 = vtransform(<0,0,0>, Xform_next);

Note that it is assumed that the original object points in the +Z direction,
so that +Z gets transformed to point in the direction of the slope of the
line.

Now, this works great for objects such as spheres and such.  It even orients
the textures properly, something I wasn't able to do before.  The problem I
run into is when I try to do connected objects, like the old standby tool
CTDS does.

Finding the main orientation of the object is easy:
    #declare Z2 = vnormalize(Pt1 - Pt0);
    #declare ScaleObj = object { Base scale <1,1,vlength(Pt1 - Pt0)> } //
Make sure it's the right length

But finding X2 and Y2 (the orientation for up and right, respectively) is
bothering me.  I'd like to get something that is somewhere in between the
transforms for the point at the current location (Xt0 and Yt0) and the
transforms for the next location (Xt1 and Yt1) and also maintain the aspects
between X2, Y2, and Z2, so that if the positioning macros provide, for
instance, any shearing, it is preserved as closely as possible.  Obviously,
there won't be a perfect solution.  The closest to that is simply to use
infinitely many points.  But I'd like to get something close.

Thanks in advance to any and all takers.

Incidently, my macro set promises to be capable of BioWin style creations,
as well as chains and columns and ropes and probably lots of other nifty
things.  Since all the paths are user defined and the objects can be user
defined, it is very flexible.  I'm working on different ways of binding
textures to the results, as well as varying the object scaling by T using
another user defined macro.  I'll post the final version on p.b.s-f (and on
a web page, once I get one set up), and probably some images along the way
at p.b.i.


Thanks to all who participate here.  I've spent the last month or so
catching up on all sorts of things I've missed out on, since I've been
working in isolation for quite a while.  Again, thanks to all.

Michael


Post a reply to this message

From: Tom Melly
Subject: Re: Orienting with multiple matrices
Date: 7 Sep 2001 07:45:55
Message: <3b98b373@news.povray.org>
"Redbeard (MDJohnson)" <red### [at] wvadelphianet> wrote in message
news:3b989d71@news.povray.org...
> Hello all -

<snip>

and hello back. I can't help, but just wanted to warn you that you might get a
slower response than is usual....


Post a reply to this message

From: Jan Walzer
Subject: Re: Orienting with multiple matrices
Date: 7 Sep 2001 15:26:42
Message: <3b991f72@news.povray.org>
lol


Post a reply to this message

From: Redbeard (MDJohnson)
Subject: Re: Orienting with multiple matrices
Date: 8 Sep 2001 20:19:33
Message: <3b9ab595@news.povray.org>
"Tom Melly" <tom### [at] tomandlucouk> wrote in message
news:3b98b373@news.povray.org...
> "Redbeard (MDJohnson)" <red### [at] wvadelphianet> wrote in message
> news:3b989d71@news.povray.org...
> > Hello all -
>
> <snip>
>
> and hello back. I can't help, but just wanted to warn you that you might
get a
> slower response than is usual....
>
>

I know... I'm playing with POV-Ray 3.5 too... ;-)

Michael


Post a reply to this message

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