Quaternion Interpolation in Forth?

  • Follow


I am looking for a Forth version of interpolation of 3D angles.
Any idea where one might be found?

jrh    
0
Reply no18 (4421) 12/3/2006 6:01:28 AM

jrh wrote:
> I am looking for a Forth version of interpolation of 3D angles.
> Any idea where one might be found?
> 
> jrh    

Look at

    http://www.taygeta.com/fsl/library/quaternions.f

-- 
Julian V. Noble
Professor Emeritus of Physics
University of Virginia
0
Reply jvn (707) 12/3/2006 7:37:33 PM


"Julian V. Noble" <jvn@virginia.edu> wrote in news:ekv91p$o7o$1
@murdoch.acc.Virginia.EDU:

> http://www.taygeta.com/fsl/library/quaternions.f

Thanks for the link,

The problem is to develop a fast method of determining if a
line from the apex of a triangular pyramid, goes through
the base.  If it does determine the x y z interpolation constants
otherwise repeat the process.   

The quaternion code isn't exactly what I need, but it's
a starting point.  The goal is to simulate a Physics problem,
using statistical multiplexing.
 

John Hart
0
Reply no18 (4421) 12/4/2006 6:59:39 AM

On Sun, 3 Dec 2006 22:59:39 -0800, jrh wrote
(in article <Xns988EF416EEFC1nospamcom@69.28.173.184>):

> The problem is to develop a fast method of determining if a
> line from the apex of a triangular pyramid, goes through
> the base.  If it does determine the x y z interpolation constants
> otherwise repeat the process. 

Triangular pyramid. Is that a tetrahedron? I'm trying to picture the problem. 
Isn't there a simple vector algebra solution? It seems, granted just a guess, 
that you could do it all with dot products, which is what computers love to 
do.

And xyz interp constants? Something to do with where it pierces the base? 
Approximate direction cosines as rational numbers perhaps?

If the apex is at the origin and the base "down" perhaps a comparison of 
direction cosines of the three legs and the line.

-- Charlie Springer

0
Reply RAM6246 (431) 12/4/2006 7:21:58 AM

"jrh" <no@spam.com> a �crit dans le message de news: 
Xns988EF416EEFC1nospamcom@69.28.173.184...
> "Julian V. Noble" <jvn@virginia.edu> wrote in news:ekv91p$o7o$1
> @murdoch.acc.Virginia.EDU:
>
>> http://www.taygeta.com/fsl/library/quaternions.f
>
> Thanks for the link,
>
> The problem is to develop a fast method of determining if a
> line from the apex of a triangular pyramid, goes through
> the base.  If it does determine the x y z interpolation constants
> otherwise repeat the process.
>

Another method is to use the faces planes equations:

Use normalised planes equations, such as the planes normals
directions are inside the pyramid.

Base
    Fb(x,y,z) = a*x + b*y + c*z + d = 0

For 3 (or more, but convex) faces:

    F1(x,y,z) = a1*x + ... +d1 = 0
    F2(x,y,z) = a2*x + ... +d2 = 0
    ...
    Fn(...)   = an ........+dn = 0

Solution:

    find line intersection with base:
        point Pi = (Xi, Yi, Zi)
    FOR i=1 to n
    | IF Fi(Xi, Yi, Zi)<0 return outside
    return inside (or limit epsilon ?)

The problem is a bit complicated if the polyhedron
is not convex, but the method is the same.


Charles


> The quaternion code isn't exactly what I need, but it's
> a starting point.  The goal is to simulate a Physics problem,
> using statistical multiplexing.
>
>
> John Hart 


0
Reply cm175872 (74) 12/4/2006 8:28:49 AM

"Celime" <cm175872@scarlet.be> a �crit dans le message de news: 
ApWdnR-w-ZnUQe7YRVnyuA@scarlet.biz...
>

for clarity:

Solution:

    find line intersection with base:
        point PI = (XI, YI, ZI)
    FOR j=1 to n
    | IF Fj(XI, YI, ZI)<0 return outside
    return inside (or limit epsilon ?)

It's funny to notice that a plane equation is like
quaternion with another interpretation for the
independent term.

    plane: d = distance to origin.
    quaternion: d = rotation around (a,b,c) axis. 


0
Reply cm175872 (74) 12/4/2006 8:45:03 AM

Celime wrote:

   ...

> The problem is a bit complicated if the polyhedron
> is not convex, but the method is the same.

Can a tetrahedron be concave?

Jerry
-- 
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
0
Reply jya (12870) 12/4/2006 4:32:10 PM

Charlie Springer <RAM@regnirps.com> wrote in
news:0001HW.C1990C960038E9DBF04075B0@news.nw.centurytel.net: 

> On Sun, 3 Dec 2006 22:59:39 -0800, jrh wrote
> (in article <Xns988EF416EEFC1nospamcom@69.28.173.184>):

>> The problem is to develop a fast method of determining if a
>> line from the apex of a triangular pyramid, goes through
>> the base.  If it does determine the x y z interpolation constants
>> otherwise repeat the process. 
 
> Triangular pyramid. Is that a tetrahedron? 

A tetrahedron is a triangular pyramid with all edges equal length.

The three base edges are equal length and edges to the apex are
approximately twice as long.   

> I'm trying to picture the problem. Isn't there a simple vector
> algebra solution? It seems, granted just a guess, that you could
> do it all with dot products, which is what computers love to do.
 
> And xyz interp constants? Something to do with where it pierces the
> base? Approximate direction cosines as rational numbers perhaps?

The set of constants are going to be applied to the triangle
created by a plane passing through a pyramid to determine where
the line intersects the plane.
 
> If the apex is at the origin and the base "down" perhaps a comparison
> of direction cosines of the three legs and the line.
 
jrh
0
Reply no18 (4421) 12/5/2006 5:29:09 AM

"Jerry Avins" <jya@ieee.org> a �crit dans le message de news: 
FvmdneNxrZUQ0OnYnZ2dnUVZ_rOdnZ2d@rcn.net...
> Celime wrote:
>
>   ...
>
>> The problem is a bit complicated if the polyhedron
>> is not convex, but the method is the same.
>
> Can a tetrahedron be concave?

No, for a tetrahedron, it is not possible.

>
> Jerry
> -- 
> Engineering is the art of making what you want from things you can 
> get.
> ����������������������������������������������������������������������� 


0
Reply cm175872 (74) 12/5/2006 7:33:45 AM

jrh wrote:
> Charlie Springer <RAM@regnirps.com> wrote in
> news:0001HW.C1990C960038E9DBF04075B0@news.nw.centurytel.net: 
> 
>> On Sun, 3 Dec 2006 22:59:39 -0800, jrh wrote
>> (in article <Xns988EF416EEFC1nospamcom@69.28.173.184>):
> 
>>> The problem is to develop a fast method of determining if a
>>> line from the apex of a triangular pyramid, goes through
>>> the base.  If it does determine the x y z interpolation constants
>>> otherwise repeat the process. 
>  
>> Triangular pyramid. Is that a tetrahedron? 
> 
> A tetrahedron is a triangular pyramid with all edges equal length.

That's a /regular/ tetrahedron.

> The three base edges are equal length and edges to the apex are
> approximately twice as long.  

So it's not regular. It's still bounded by four planes, and that's what 
makes that particular polyhedron a *tetra*hedron.

   ...

Jerry
-- 
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
0
Reply jya (12870) 12/5/2006 3:40:03 PM

Celime wrote:
> "Jerry Avins" <jya@ieee.org> a �crit dans le message de news: 

   ...

>> Can a tetrahedron be concave?
> 
> No, for a tetrahedron, it is not possible.

Thanks. That's what I thought.

Jerry
-- 
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
0
Reply jya (12870) 12/5/2006 3:41:03 PM

jrh wrote:
> Charlie Springer <RAM@regnirps.com> wrote in
> news:0001HW.C1990C960038E9DBF04075B0@news.nw.centurytel.net: 
> 
>> On Sun, 3 Dec 2006 22:59:39 -0800, jrh wrote
>> (in article <Xns988EF416EEFC1nospamcom@69.28.173.184>):
> 
>>> The problem is to develop a fast method of determining if a
>>> line from the apex of a triangular pyramid, goes through
>>> the base.  If it does determine the x y z interpolation constants
>>> otherwise repeat the process. 
>  

How about this:

   1. project the line through the x-y (base) plane.

   2. locate the point of intersection (i.e. the coordinates
      at z=0 in the x-y plane).

   3. determine whether that point is inside or outside the
      base triangle.

There is a simple algorithm for #3. Easiest in complex arithmetic.
So I fail to see the need for quaternions in this application.

-- 
Julian V. Noble
Professor Emeritus of Physics
University of Virginia
0
Reply jvn (707) 12/5/2006 10:15:38 PM

Julian V. Noble wrote:

  ...

> There is a simple algorithm for #3. Easiest in complex arithmetic.
> So I fail to see the need for quaternions in this application.

Dot product?

Jerry
-- 
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
0
Reply jya (12870) 12/6/2006 2:39:49 AM

Jerry Avins wrote:
> Julian V. Noble wrote:
> 
>  ...
> 
>> There is a simple algorithm for #3. Easiest in complex arithmetic.
>> So I fail to see the need for quaternions in this application.
> 
> Dot product?
> 
> Jerry

In 2 dimensions, if w = u+iv and z = x+iy represent 2 vectors
in the Argand plane, then conjg(w) * z contains both the dot
(real part) and cross (imaginary part) products of the vectors.

I will put a version of my upcoming CiSE column (March/April 07)
on complex arithmetic on my web page so you can see how to find
out if a point is inside or outside a given triangle in the plane.


-- 
Julian V. Noble
Professor Emeritus of Physics
University of Virginia
0
Reply jvn (707) 12/6/2006 9:09:37 PM

"Julian V. Noble" <jvn@virginia.edu> wrote in news:el7bij$3ei$1
@murdoch.acc.Virginia.EDU:

> Jerry Avins wrote:
>> Julian V. Noble wrote:
 
>>> There is a simple algorithm for #3. Easiest in complex arithmetic.
>>> So I fail to see the need for quaternions in this application.
 
>> Dot product?
>> Jerry
 
> In 2 dimensions, if w = u+iv and z = x+iy represent 2 vectors
> in the Argand plane, then conjg(w) * z contains both the dot
> (real part) and cross (imaginary part) products of the vectors.
 
> I will put a version of my upcoming CiSE column (March/April 07)
> on complex arithmetic on my web page so you can see how to find
> out if a point is inside or outside a given triangle in the plane.
 
Quaternions may still be necessary.  The Orientation is polar,
and positional inference is (xyz).

The following description will provide some context.

-----------------------------------------------------------------
Table for the statistical multiplexing of viewing cones.
The STAT-MUX-TABLE is used by all objects is rebuilt once each cycle.
The objects position is added to the values in the table
to compute the addresses to be sampled for each object.
The sample location is the intersection of a random angle and
a random circle in the viewing cone a random distance from the origin
The viewing cones axies are defined by the SENS-ANG table.

Mathematical constructs:
The rectangular to polar transformation of space.
-----------------------------------------------------
                                                .             .             
..
                                                   .                    .
                                                      .      .      .
                                                         .      .
                                                            .
                                                      .        .
                                                .          .       .
                                           .                           .
          . . . . . . . . . . . . . . .                   .                
..
        /   .                    .   /  .
      /       . z           .      /      .
 y  /         / ' ' ' '.' ' ' ' '/' ' ' ' '/
   \ ~ ~ ~ ~/~ ~ ~.~ ~ ~ ~ ~ ~ ~\        /
     \    /  .                    \    /
       \/_ _ _ _ _ _ _ _ _ _ _ _ _ _\/
       o                             x

    |                        .             |          .
    |                   .                  |        .
    |              .                       |      .
    |         .                            |    .
    |    .                                 |  .
    |.________________________             |.__________

  x^2 + y^2 + z^2 = p^2
  TAN a = x/y ? y/x
  TAN b = z/c ? c/z
  x = p sin b cos a
  y = p sin b sin a
  z = p cos b

  1. status.aob  ---  a angle of object          ( orientation )
  2. status.bob  ---  b angle of object          ( orientation )
  3. consta.asn  ---  a angle of sensor                         ( facet )
  4. consta.bsn  ---  b angle of sensor                         ( facet )
  5. lookup.pac  ---  plane of acquisition cone   ( orientation + facet )
  6. lookup.aac  ---  angle of acquisition cone   ( orientation + facet )
  7. random.dst  ---  distance to acquisition circle         ( DIST:DSTB)
  8. random.rad  ---  radius of acquisition cone             ( RADI:DSTB)
  9  calclu.dia  ---  diameter of acquisition circle         ( DIAM:DSTB)
 10. random.arc  ---  arc to viewing point on acquisition circle

The procedure to build the statistical multiplexer table.

Get pac, get aac  ( axis, from SENS-ANG table )
Get random distance, random arc and random radius.
Scale random radius. ( random distance )
Calculate the xyz of the point a random distance along the axis.
Calculate the xyz of the point a random angle on the viewing circle.
Add the xyz's.

Angle on plane        Rotation of the plane

VERTICES:
   A                  B
   0                  0
  31.717474411461     0       72       144       216       288
  63.434948822922     0  36   72  108  144  180  216  252  288  324
  90                  0  36   72  108  144  180  216  252  288  324
 116.565051177078     0  36   72  108  144  180  216  252  288  324
 148.282525588539     0       72       144       216       288
 180                  0

Define a plane for each facet of the 3x icosahedron
Convert sensor direction  into line from apex. (ax +by +cz = 0)
Find where the direction intersects with the plane.

rotation change?
if select interpolation set
last_sensor first_sensor
do
begin
calculate sensor line intersection point on base plane of first
facet.
point inside facet?
until
calculate offset_vector
facet i save in table
loop
then
last_sensor first_sensor
do
i get facet
  get offset_vector

------------------------
ICOSAHEDREN_FACET_TABLE        LINES from origin
SAMPLE_DISTRIBUTION_TABLE      LINES from origin rebuilt each generation
STATISTICAL_MUX_TABLE          SCALES sensors focus    (60sensors)
SAMPLE_INTERPOLATION_TABLE     VECTORS rebuilt when object rotates

The viewing cone for all 60 sensors is about 60 degrees,
each icosahedron facet is divided into 64 triangles.
1280 total facets.
interpolation points are the center of each facet.

1. Find the facet. (triangle the sensor vector passes thru)
   facet_list =    1280(x1.y1.z1,x2.y2.z2,x3.y3.z3)
   sensor_vector = (x.y.z)
2. Find the intersect point.
   facet_pointer = (1..1280)
3. Calculate the distance (xyz) between the intersect
   and the center of the facet. (translation vector)
   (save in table, update each time orientation changes)
4. Scale the translation vector by the distance the random
   sample plain is from the origin.
5. Add the translation vector to the random sample point.
-----------------------------------------------------------
copyright John R Hart
0
Reply no18 (4421) 12/14/2006 6:37:30 AM

14 Replies
28 Views

(page loaded in 0.63 seconds)


Reply: