POV-Ray : Newsgroups : povray.newusers : Orientation problem Server Time
22 Dec 2024 16:39:45 EST (-0500)
  Orientation problem (Message 1 to 3 of 3)  
From: kurtz le pirate
Subject: Orientation problem
Date: 30 Dec 2011 11:13:02
Message: <kurtzlepirate-285173.17130230122011@news.povray.org>
Hello,

I have some difficulties to orient objects.

In helping me in, see the attached picture in 'povray.binaries.images'.

I have 12 hexagons (from 0 to B). I would like to draw a torus that 
passes through the barycenters of two hexagons (the coordinates of
the barycenters are known).

In the image, i made it between hexagon '0' and hexagon '2'.

My calculations are :
 - with barycenter of hexagone '0' : v0
 - with barycenter of hexagone '2' : v2
 - compute the normalized normal vector : vn=vnormalize(vcross(v0, v2));
 - calc the lenght of v0 -> lv0
 - convert rectangulars coordinates of vn -> azimuth and rise. 


Now draw the torus :
torus {
  lv0, 0.020

  rotate (90-rise)*z
  rotate -azimuth*y
  
  pigment { color DarkTurquoise }
  finish { ambient 0.40 diffuse 0.60 }
  }

Work for this case, not with other pairs of hexagons.

It's not really a povray's question, probably more than mathematical :
Is my method of calculation is correct ?
How to properly orient my torus depending on the normal vector ?



Thanks

-- 
klp


Post a reply to this message

From: Le Forgeron
Subject: Re: Orientation problem
Date: 30 Dec 2011 11:46:04
Message: <4efdeacc$1@news.povray.org>
Le 30/12/2011 17:13, kurtz le pirate nous fit lire :
> Hello,
> 
> I have some difficulties to orient objects.
> 

> It's not really a povray's question, probably more than mathematical :
> Is my method of calculation is correct ?
> How to properly orient my torus depending on the normal vector ?

Let's sum up: you have three points in space, two hexagons & origin.
you find the plane in which the three points are. (that's the vcross)

Then you need to move a torus to align with that plane.

I would suggest

#include "transforms.inc"

and using  Reorient_Trans(y,vn)


Post a reply to this message

From: kurtz le pirate
Subject: Re: Orientation problem
Date: 31 Dec 2011 09:19:03
Message: <kurtzlepirate-601C33.15190231122011@news.povray.org>
In article <kurtzlepirate-285173.17130230122011@news.povray.org>,
 kurtz le pirate <kur### [at] yahoofr> wrote:

> Hello,
> 
> I have some difficulties to orient objects.
> [snip]
> How to properly orient my torus depending on the normal vector ?

I found my mistakes :

first :
 my rect_to_polar routine return the 'azimuth' with a wrong sign. 


second :
  rotations around y then around z is different from rotation around  z
  then around y.




Now that this issue is resolved, I can continue...

-- 
klp


Post a reply to this message

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