POV-Ray : Newsgroups : povray.general : sugestion: get_local_point Server Time
6 Nov 2024 08:18:11 EST (-0500)
  sugestion: get_local_point (Message 1 to 5 of 5)  
From: Rafal 'Raf256' Maj
Subject: sugestion: get_local_point
Date: 1 Aug 2004 07:09:19
Message: <Xns95388537A4B5Draf256com@203.29.75.35>
I have a problem when I'm doing more advanced vectors math (in animation 
for example) and some points I'm calculating "by hand" using vrotate etc, 
other are calculated by CSG and transformations. THe problem is when I need 
to convert between both methods.
Example:

union {
  union {
    object { MY_OBJECT } // object has center in <0,0,0>
    rotate x*90
    translate y*clock
    // where will be center of MY_OBJECT in here - in this context?
  }
  rotate z*sin(clock)  translate z*clock*2
  // where will be center of MY_OBJECT in here - in this context? 
}

sphere { position_of_MY_OBJECT_in_this_context 1 }

and I want last sphere to point to center of MY_OBJECT, with is not easy as 
it is in other transformations context and I would heve to repeat all CSG 
transforamtions manualy to calcaulate that point, with is not very 
comfortable.

My suggestion is to allow syntax like:

union {
  union {
    object { MY_OBJECT } 
    #declare A = local_point(<0,0,0>);
    rotate x*90
    translate y*clock
  }
  #local B = get_vector(A); // point "B" will be a normal vector that will
  // not automagicly move like A do

  rotate z*sin(clock)  translate z*clock*2
}

sphere { get_vector(A) 1 }

This should be very usable i.e. for animations when movment is created by 
POV-Ray CSG/macros, not by external program.

Suggested implementation - after declaring local_point, it will automaticly  
have all parsed transforms applyed to it.

-- 
http://www.raf256.com/3d/
Rafal Maj 'Raf256', home page - http://www.raf256.com/me/
Computer Graphics


Post a reply to this message

From: Mike Williams
Subject: Re: sugestion: get_local_point
Date: 1 Aug 2004 07:50:21
Message: <fb674AAZjNDBFwV7@econym.demon.co.uk>
Wasn't it Rafal 'Raf256' Maj who wrote:
>I have a problem when I'm doing more advanced vectors math (in animation 
>for example) and some points I'm calculating "by hand" using vrotate etc, 
>other are calculated by CSG and transformations. THe problem is when I need 
>to convert between both methods.
>Example:
>
>union {
>  union {
>    object { MY_OBJECT } // object has center in <0,0,0>
>    rotate x*90
>    translate y*clock
>    // where will be center of MY_OBJECT in here - in this context?
>  }
>  rotate z*sin(clock)  translate z*clock*2
>  // where will be center of MY_OBJECT in here - in this context? 
>}
>
>sphere { position_of_MY_OBJECT_in_this_context 1 }
>
>and I want last sphere to point to center of MY_OBJECT, with is not easy as 
>it is in other transformations context and I would heve to repeat all CSG 
>transforamtions manualy to calcaulate that point, with is not very 
>comfortable.

You don't have to repeat the transforms, you just have to declare them
separately from the objects that you want to transform, like this:

#declare MOVEMENT = transform {
    rotate x*90
    translate y*clock
    rotate z*sin(clock)
    translate z*clock*2
}    

union {
  union {
    object { MY_OBJECT }        // The main object moved
    transform {MOVEMENT}
  }
}

sphere {0,1 transform {MOVEMENT}} // A sphere moved the same way



-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: sugestion: get_local_point
Date: 1 Aug 2004 08:08:24
Message: <Xns95388F3BD807raf256com@203.29.75.35>
nos### [at] econymdemoncouk news:fb6### [at] econymdemoncouk

> union {
>   union {
>     object { MY_OBJECT }        // The main object moved
>     transform {MOVEMENT}
>   }
> }
> sphere {0,1 transform {MOVEMENT}} // A sphere moved the same way

But what if:

union {
  union {
    difference {
      union { 
        object { MY_OBJECT } 
        transforms 
      }
      transforms
    }
    transforms
  }
  transforms
}


> sphere {0,1 transform {MOVEMENT}} // A sphere moved the same way

But I need a wector - so that I can do mathematic calculations on it (i.e. 
interpolate it, write it to file, etcP




-- 
http://www.raf256.com/3d/
Rafal Maj 'Raf256', home page - http://www.raf256.com/me/
Computer Graphics


Post a reply to this message

From: Slime
Subject: Re: sugestion: get_local_point
Date: 1 Aug 2004 14:44:25
Message: <410d3a09@news.povray.org>
> But what if:
>
> union {
>   union {
>     difference {
>       union {
>         object { MY_OBJECT }
>         transforms
>       }
>       transforms
>     }
>     transforms
>   }
>   transforms
> }

You may have to declare all of the transformations separately. If you want,
you can keep them all in place like this:

union {
  union {
    difference {
      union {
        object { MY_OBJECT }
        #declare trans1 = transform{...}
        transform{trans1}
      }
      #declare trans2 = transform{...}
      transform{trans2}
    }
    #declare trans3 = transform{...}
    transform{trans3}
  }
  #declare trans4 = transform{...}
  transform{trans4}
}

> But I need a wector - so that I can do mathematic calculations on it (i.e.
> interpolate it, write it to file, etcP

#declare MyVector = vtransform(MyVector, trans1); // (repeat for other
transformations)

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: sugestion: get_local_point
Date: 3 Aug 2004 07:55:02
Message: <Xns953A8E0FB2B96raf256com@203.29.75.35>
fak### [at] emailaddress news:410d3a09@news.povray.org

> #declare MyVector = vtransform(MyVector, trans1); // (repeat for other
> transformations)

Thanks, that almost perfect solution :)

-- 
http://www.raf256.com/3d/
Rafal Maj 'Raf256', home page - http://www.raf256.com/me/
Computer Graphics


Post a reply to this message

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