POV-Ray : Newsgroups : povray.general : Help! Can anyone figure this math? Server Time
18 Oct 2026 09:32:53 EDT (-0400)
  Help! Can anyone figure this math? (Message 1 to 22 of 22)  
From: Philippe Debar
Subject: Help! Can anyone figure this math?
Date: 28 Aug 1998 17:48:23
Message: <35e71797.0@news.povray.org>
I was totally unable to solve this problem for a pov scene.
I found a workaround, but I am not totally satisfied with it.

The problem is to get a smooth joint between differently
oriented surfaces. In this case, two boxes rotated around
the z-axis. I wanted to use a scaled cylinder (to get an
ellipse). What are (1) the location of the center of the scaled
cylinder, (2) the 'left' x radius and (3) the 'up' y radius to get
the cylinder tangeant to the boxes. I don't think that rotating the
cylinder around the z-axis is necessary.

I tried to solve the problem with the following equations:

An ellipse has to passes through point A(Xa, Ya) and
B(Xb, Yb). Its axis are parallel to the main axis. The
orientation of the tangent in A and B are given: Ta, Tb

P0(X0, Y0) the 'center' of the ellipse (center of a
scaled circle)
As I use a scaled circle, I use semi-axis of R and
s*R

So we have for each point

(Xa-X0)^2+(Ya-Y0)^2/L^2=R^2

this is equivalent to

Xa = X0 + R cos(Aa)
Ya = Y0 + L R sin(Aa)

Aa is the parametric angle A for point A
(note that this is in on way the real angle
from OX to OA)

And the tangent:
Xa'= -R sin(Aa)
Ya'= L R cos(Aa)

=> Ta = Ya' / Xa' =  -L / tan(Aa)

...same equations for point B...

So we have a system of 6 equations, with 6 unknowns:
X0, Y0, R, L, Aa, Ab.
Aa an Ab are of no interrest but can be necessary
to solve the system.

I tried but was unable to get an answer - it was to
complicated for me, and I can no longer access
a copy of Mathematica, so...


Any help welcome,

Thank you very much,

Philippe


Post a reply to this message

From: Stephen Lavedas
Subject: Re: Help! Can anyone figure this math?
Date: 28 Aug 1998 18:41:46
Message: <35E7243F.B7CDFF19@Ragingbull.com>
You are working too hard.  The scaled cylinder is not an ellipse. It is
merely a cylinder with a scaled axis.  There are several differences,
not the least of being the definition.  A cylinder is defined easily by
x = rcos(theta) and y = rsin(theta) (or vis versa) So try working with 
x = rcos(theta)
y = Rsin(thete) 

so the x position 30 degrees around the cylinder would be r*sqrt(3)/2
and the y position would be R*0.5 if you move the cylinder, simply add
the displacement to the values above.  

Philippe Debar wrote:
> 
> I was totally unable to solve this problem for a pov scene.
> I found a workaround, but I am not totally satisfied with it.
> 
> The problem is to get a smooth joint between differently
> oriented surfaces. In this case, two boxes rotated around
> the z-axis. I wanted to use a scaled cylinder (to get an
> ellipse). What are (1) the location of the center of the scaled
> cylinder, (2) the 'left' x radius and (3) the 'up' y radius to get
> the cylinder tangeant to the boxes. I don't think that rotating the
> cylinder around the z-axis is necessary.
> 
> I tried to solve the problem with the following equations:
> 
> An ellipse has to passes through point A(Xa, Ya) and
> B(Xb, Yb). Its axis are parallel to the main axis. The
> orientation of the tangent in A and B are given: Ta, Tb
> 
> P0(X0, Y0) the 'center' of the ellipse (center of a
> scaled circle)
> As I use a scaled circle, I use semi-axis of R and
> s*R
> 
> So we have for each point
> 
> (Xa-X0)^2+(Ya-Y0)^2/L^2=R^2
> 
> this is equivalent to
> 
> Xa = X0 + R cos(Aa)
> Ya = Y0 + L R sin(Aa)
> 
> Aa is the parametric angle A for point A
> (note that this is in on way the real angle
> from OX to OA)
> 
> And the tangent:
> Xa'= -R sin(Aa)
> Ya'= L R cos(Aa)
> 
> => Ta = Ya' / Xa' =  -L / tan(Aa)
> 
> ...same equations for point B...
> 
> So we have a system of 6 equations, with 6 unknowns:
> X0, Y0, R, L, Aa, Ab.
> Aa an Ab are of no interrest but can be necessary
> to solve the system.
> 
> I tried but was unable to get an answer - it was to
> complicated for me, and I can no longer access
> a copy of Mathematica, so...
> 
> Any help welcome,
> 
> Thank you very much,
> 
> Philippe


Post a reply to this message

From: Stephen Lavedas
Subject: Re: Help! Can anyone figure this math?
Date: 28 Aug 1998 18:43:03
Message: <35E7248D.1E1DEF8F@Ragingbull.com>
I actually defined a circle above, but you merely have to extrude my
formula on the third axis to create a cylinder... just wanted to
clarify, it doesn't change the validity of the formulii

Stephen Lavedas wrote:
> 
> You are working too hard.  The scaled cylinder is not an ellipse. It is
> merely a cylinder with a scaled axis.  There are several differences,
> not the least of being the definition.  A cylinder is defined easily by
> x = rcos(theta) and y = rsin(theta) (or vis versa) So try working with
> x = rcos(theta)
> y = Rsin(thete)
> 
> so the x position 30 degrees around the cylinder would be r*sqrt(3)/2
> and the y position would be R*0.5 if you move the cylinder, simply add
> the displacement to the values above.
>


Post a reply to this message

From: Philippe Debar
Subject: Re: Help! Can anyone figure this math?
Date: 29 Aug 1998 13:34:35
Message: <35e82d9b.0@news.povray.org>
Hi Stephen (and everybody else reading this)

I am sorry, but I do not understand your answer. Well,
I think I understand it, but I do not see how it can solve
my problem.

I don't see the difference between
(a) working with semi-axis ('radii') of r and R
and
(b) semi-axis of R and L*R

Isn't a scaled circle (cylinder) an ellipse ?
circle at origin:
  x=R*cos(theta)
  y=R*sin(theta)

scale <1,L,*> =>
  x=1*R*cos(theta)=R*cos(theta)
  y=L*R*cos(theta)

translate <x0,y0,*>
  x=x0+R*cos(theta)
  y=y0+L*R*cos(theta)

- this is an ellipse


Is this wrong?

(See also my next post which explain my
problem further)


Thanks


Philippe


Post a reply to this message

From: Philippe Debar
Subject: Re: Help! Can anyone figure this math?
Date: 29 Aug 1998 13:38:17
Message: <35e82e79.0@news.povray.org>
Hi everybody!

I seem to have difficulties to explain my problem
clearly. Here's another try:

With ascii geometry, in a plane:


-------------+
              \
Volume  A      \
                \
-----------------+   <--- point A

          Find the scaled cylinder that will
          smoothly join these two surfaces.

--------------+        <--- point B
             /
  Volume B  /
           /
----------+


Why a scaled cylinder? Because I can the use the solution
to smoothly join two cones with a scaled torus.

The problem is to find the center and the two semi-axis
of an ellipse whose axis are parallel to the world axis,
that is tangent with two given half lines on their end
point. That is:



         \
          \      half line a
           \
            \
             +   <--- end point A


          Find the ellipse that will
          smoothly join these two half lines.


          +        <--- end point B
         /
        /
       /
      /



Thank you for your time,

Sincerely,


Philippe


Post a reply to this message

From: Stephen Lavedas
Subject: Re: Help! Can anyone figure this math?
Date: 29 Aug 1998 17:10:32
Message: <35E85E76.CC135024@Ragingbull.com>
A ellipse has the formula (in two dimensions) x^2/a^2 + y^2/b^2 = c^2
where the major axis is a or b depending on which is larger.  In an
ellipse, any ray drawn from a foci and bounced off a wall will terminate
in the other foci.  There are actually two foci instead of one radius. 
Anyhow...question for you... where is the center of the torus you use in
relation to the boxes?  I ask this, because from the image, I think
rotation of the cylinder is required.  However if you send me some
source I could be more helpful... (feel free to email it to me)

Steve



Philippe Debar wrote:
> 
> Hi Stephen (and everybody else reading this)
> 
> I am sorry, but I do not understand your answer. Well,
> I think I understand it, but I do not see how it can solve
> my problem.
> 
> I don't see the difference between
> (a) working with semi-axis ('radii') of r and R
> and
> (b) semi-axis of R and L*R
> 
> Isn't a scaled circle (cylinder) an ellipse ?
> circle at origin:
>   x=R*cos(theta)
>   y=R*sin(theta)
> 
> scale <1,L,*> =>
>   x=1*R*cos(theta)=R*cos(theta)
>   y=L*R*cos(theta)
> 
> translate <x0,y0,*>
>   x=x0+R*cos(theta)
>   y=y0+L*R*cos(theta)
> 
> - this is an ellipse
> 
> Is this wrong?
> 
> (See also my next post which explain my
> problem further)
> 
> Thanks
> 
> Philippe


Post a reply to this message

From: Peter Popov
Subject: Re: Help! Can anyone figure this math?
Date: 30 Aug 1998 02:52:44
Message: <35e8e8ac.0@news.povray.org>
Well, seems to me eveeryone's working on the trigonometric solution...
here's a cheep 'n' cheesy one. You'll need two points on each surface,
though (and their order must match)

#declare A1=<Ax,Ay,Az> // point A1
#declare B1=<Bx,By,Bz>  // point B1
#declare A2=<Ax,Ay,Az> // point A2
#declare B2=<Bx,By,Bz>  // point B2
#declare tangentA=<tAx,tAy,tAz> // tangent at A
#declare tangentB=<tBx,tBy,tBz>  // tangent at B

// The tangents of the surfaces have to point in the direction of the
joining surface.
// Anyway that's easy to correct with a tangentA_direction (+1 or -1) etc.

#declare weightA = 1  // how strongly the tangent of A "attracts" the
tangent of the joining surface
#declare weightB = 1  // same as above

#declare addToA = weightA*tangentA
#declare addToB = weightB*tangentB

bicubic_patch
{ type 1
   flatness 0
   u_steps 4
   v_steps 4
    A1, (A1+A2)/3, (A1+A2)*2/3, A2,
    A1, (A1+A2)/3+addToA, (A1+A2)*2/3+addToA, A2+addToA,
    B1, (B1+B2)/3+addToB, (B1+B2)*2/3+addToB, A2+addToB,
    B1, (B1+B2)/3, (B1+B2)*2/3, B2,
}

I haven't tested this, but it looks OK to me. Of course, you can't use it in
CGS. If you want to do intersections and/or differences, try using prisms
instead. Well, they extrude along y, so you'll have be careful. Also, when
using a cubic_spline in prisms keep in mind it starts from the second point
and ends at the second-to-last, so the tangents should point opposite to
what is used above, plus you'll have to interchange points 1&2 and points
3&4 from the above example.

Hope this helps.

--Peter

pet### [at] usanet



Philippe Debar wrote in message <35e71797.0@news.povray.org>...
>I was totally unable to solve this problem for a pov scene.
>I found a workaround, but I am not totally satisfied with it.
>
>The problem is to get a smooth joint between differently
>oriented surfaces. In this case, two boxes rotated around
>the z-axis. I wanted to use a scaled cylinder (to get an
>ellipse). What are (1) the location of the center of the scaled
>cylinder, (2) the 'left' x radius and (3) the 'up' y radius to get
>the cylinder tangeant to the boxes. I don't think that rotating the
>cylinder around the z-axis is necessary.
>
>I tried to solve the problem with the following equations:
>
>An ellipse has to passes through point A(Xa, Ya) and
>B(Xb, Yb). Its axis are parallel to the main axis. The
>orientation of the tangent in A and B are given: Ta, Tb
>
>P0(X0, Y0) the 'center' of the ellipse (center of a
>scaled circle)
>As I use a scaled circle, I use semi-axis of R and
>s*R
>
>So we have for each point
>
>(Xa-X0)^2+(Ya-Y0)^2/L^2=R^2
>
>this is equivalent to
>
>Xa = X0 + R cos(Aa)
>Ya = Y0 + L R sin(Aa)
>
>Aa is the parametric angle A for point A
>(note that this is in on way the real angle
>from OX to OA)
>
>And the tangent:
>Xa'= -R sin(Aa)
>Ya'= L R cos(Aa)
>
>=> Ta = Ya' / Xa' =  -L / tan(Aa)
>
>...same equations for point B...
>
>So we have a system of 6 equations, with 6 unknowns:
>X0, Y0, R, L, Aa, Ab.
>Aa an Ab are of no interrest but can be necessary
>to solve the system.
>
>I tried but was unable to get an answer - it was to
>complicated for me, and I can no longer access
>a copy of Mathematica, so...
>
>
>Any help welcome,
>
>Thank you very much,
>
>Philippe
>
>


Post a reply to this message

From: Philippe Debar
Subject: Re: Help! Can anyone figure this math?
Date: 30 Aug 1998 16:17:36
Message: <35e9a550.0@news.povray.org>
Hello math fans...

I still seem to have difficulties making myself undersood.
A too long time since school and the lack of proper english
mathematic vocabulary aren't helping ;-)

So, here we go for another try:

Stephen Lavedas wrote in message <35E85E76.CC135024@Ragingbull.com>...
>A ellipse has the formula (in two dimensions) x^2/a^2 + y^2/b^2 = c^2
>where the major axis is a or b depending on which is larger.

...hmm, let me see... it seems that... hmm... yes... ...
er... I'll need that book... thank you... and, er... that one too...

x^2/a^2 + y^2/b^2 = c^2 surely is an ellipse... but of axis 2*a*c and
2*b*c. You surely meant x^2/a^2 + y^2/b^2 = 1.

This ellispse has its center (the intersection of the two axis) at <0,0> and
two focii (I do not know their coordinates, but this doesn't matter here).

x^2/a^2 + y^2/b^2 = 1 is the cartesian equation (in rectangular
coordinates) of the ellipse. The pair of trigonometric equations
I tried was the parametric equation (in rectangular coordinates)
and is equivalent to the cartesian one (they describe the same
shape).

... or so I believe, but I can of course be wrong.

>Anyhow...question for you... where is the center of the torus you use in
>relation to the boxes?

That's a part of what I am trying to solve. Given: (in plane) two points
their tangents; unknown an ellipse (center and two half-axis). The
system of six equations for six unknowns led me to believe that it can
be done without the rotation of the cylinder. But maybe the system is
unsolvable this way and you really need the rotation. My purpose
would be defeated if this was the case.

>However if you send me some source I could be more helpful...
>(feel free to email it to me)

I can't: I am writing macros to do linear mouldings as well as collumns
relief, so I am after a general solution. But if you want, I can post or
email what I have already done. The file isn't very long, but is written
in a kind of franglais, with architectural terms my dictionnary can't
translate.



Thank you again for your help,

Thruthfully,


Philippe


Post a reply to this message

From: Philippe Debar
Subject: Re: Help! Can anyone figure this math?
Date: 30 Aug 1998 16:27:39
Message: <35e9a7ab.0@news.povray.org>
Greetings!

Peter Popov wrote in message <35e8e8ac.0@news.povray.org>...
>Well, seems to me eveeryone's working on the trigonometric solution...
>here's a cheep 'n' cheesy one. You'll need two points on each surface,
>....<

Thanks, Peter, for your solution. You've guessed: I do need CSG operations.
And I'd really like to solve my problem with a cylinder (or, as the case may
be, a torus between cones). That's a purity and code elegance (and perhaps
stupid) affair.


But I printed your answer and will keep it handy.


Thank you again,

Sincerely,

Philippe


Post a reply to this message

From: Peter Popov
Subject: Re: Help! Can anyone figure this math?
Date: 31 Aug 1998 02:46:50
Message: <35ea38ca.0@news.povray.org>
Hi Philippe!

Philippe Debar wrote in message <35e9a7ab.0@news.povray.org>...
>Greetings!
>
>Peter Popov wrote in message <35e8e8ac.0@news.povray.org>...
>>Well, seems to me eveeryone's working on the trigonometric solution...
>>here's a cheep 'n' cheesy one. You'll need two points on each surface,
>>....<
>
>Thanks, Peter, for your solution. You've guessed: I do need CSG operations.
>And I'd really like to solve my problem with a cylinder (or, as the case
may
>be, a torus between cones). That's a purity and code elegance (and perhaps
>stupid) affair.
>

Code elegance is a very important thing, especially when it comes to IRTC or
patching POV :)

>
>But I printed your answer and will keep it handy.

I'm afraid there was a typo in what I posted here... Dan Conelly pointed in
out to me in an e-mail. Here we go:

<clip>

    A1, (A1+A2)/3, (A1+A2)*2/3, A2,
    A1+addToA, (A1+A2)/3+addToA, (A1+A2)*2/3+addToA, A2+addToA,
    B1+addToB, (B1+B2)/3+addToB, (B1+B2)*2/3+addToB, A2+addToB,
    B1, (B1+B2)/3, (B1+B2)*2/3, B2,

<clip>

Anyway, if CSG is what you need I still think a prism is the easiest choice.
Here's an example:

I still assume you want to join two straight edges; however, as opposed to
the
bicubic_patch example, they *must* be parallel. I will assume they are
vertical
(to make my prism easier) but you can transform the prism later. Also, the
tangents must be horizontal. Lastly, here +x is right, +y is up, +z is
inside

#declare A1=<Ax,Ay,Az> // point A1, vertex 1 of edge A
#declare B1=<Bx,By,Bz>  // point B1, vertex 1 of edge B
#declare A2=<Ax,Ay,Az> // point A2, vertex 2 of edge B
#declare B2=<Bx,By,Bz>  // point B2, vertex 2 of edge B
#declare tangentA=<tAx,tAy,tAz> // tangent at A,
#declare tangentB=<tBx,tBy,tBz>  // tangent at B

// The tangents of the surfaces have to point opposite to the direction
// of the joining surface.

#declare weightA = 1  // how strongly the tangent of A "attracts" the
tangent of the joining surface
#declare weightB = 1  // same as above
#declare addToA = weightA*tangentA
#declare addToB = weightB*tangentB
prism
{
  cubic_spline
  linear_sweep
  A1.y, A2.y, 4,
  A1+addToA, A1, B1, B1+addToB
}

This should generate a prism from edge A1-A2 to edge B1-B2. I am not sure
how you should close this prism, though

>Thank you again,
>
>Sincerely,
>
>Philippe
>

Glad to help.

Regards,

Peter

P.S. Sorry, I'm not very much into elegant coding


Post a reply to this message

From: Philippe Debar
Subject: Re: Help! Can anyone figure this math?
Date: 31 Aug 1998 04:30:26
Message: <35ea5112.0@news.povray.org>
Thanks again for your help Peter. I printed this one too. By the way,
would you know how to make straight lines and corners in an otherwise
cubic_spline prism? (I can already do this with CSG).


Thruthfully,


Philippe


Post a reply to this message

From: Peter Popov
Subject: Re: Help! Can anyone figure this math?
Date: 31 Aug 1998 04:41:47
Message: <35ea53bb.0@news.povray.org>
For a straight line make a point coincide with the previous one and the next
point coincide with the following one. Example:

<point1>, <point2>, ... <point7>, <point7>, <point8>, <point8>, <point9>
etc.

For an edge, use

...<point3>, <point4>, <point4>, <point5>, etc...

If this doesn't help, consult Chris Colefax's spline include file
documentation.


Post a reply to this message

From: Philippe Debar
Subject: Re: Help! Can anyone figure this math?
Date: 31 Aug 1998 14:57:05
Message: <35eae3f1.0@news.povray.org>
Thank you once again!

Philippe


Post a reply to this message

From: Peter Popov
Subject: Re: Help! Can anyone figure this math?
Date: 31 Aug 1998 17:28:12
Message: <35eb075c.0@news.povray.org>
It may be too late now, but I have a question: can't you use spheres to join
cones? Here's a clip from an include I am writing:

// Last, Current, Next are vectors
// RLast,  RCurrent, RNext are floats

union
{ cone { Last, RLast, Current, RCurrent }
   cone { Current, RCurrent, Next, RNext }

intersection
{
    sphere { Current, RCurrent }
    union
    {
        intersection
        {
            plane { Next-Current, 0 translate Current }
            plane { Current-Last, 0 translate Current inverse }
        }
        intersection
        {
            plane { Next-Current, 0 translate Current inverse}
            plane { Last-Current, 0 translate Current inverse}
        }
    }
    bounded_by { sphere { Current, RCurrent*1.00001 } }
}

}

The rather complex CSG is used to ensure that only the part of the sphere
joining the two cones is used, and the rest is clipped.

Hope this helps.

Peter

P.S. I am not very good in intersecting planes, so this code isn't very
clear. If you find a better way to do the above please post it here. 10x


Post a reply to this message

From: Philippe Debar
Subject: Re: Help! Can anyone figure this math?
Date: 31 Aug 1998 18:10:52
Message: <35eb115c.0@news.povray.org>
Peter Popov wrote in message <35eb075c.0@news.povray.org>...
>It may be too late now,
Never too late. As I said in my first post, I found a workaround - and
you provided others. So urgency is out... but I'd like to know the
'good' solution.

>but I have a question: can't you use spheres to join
>cones?
Yes... but the torus and the sphere solutions handle different cases.
With a sphere, you can join cones on different axis, you can't with
a torus. My cones would be on the same axis. They could be joined
smoothly by either adding a torus or removing a torus from a
cylinder. You can't do that with a sphere.

>Here's a clip from an include I am writing:
>(...)
>The rather complex CSG is used to ensure that only the part of the sphere
>joining the two cones is used, and the rest is clipped.
>P.S. I am not very good in intersecting planes, so this code isn't very
>clear. If you find a better way to do the above please post it here. 10x


Kind of 'connect the dots' code? I tend to use boxes rather than planes,
this is a old habit. I never ever checked, but I have a feeling that pov is
(or was) quicker with finite boxes then with infinite planes. I may be
completely mistaken.
I tried unsucessfully to simplify the principle of your code. I found other
ways to work but they were just as complicated. The only advice I can
give is to be more systematic. For example, either you switch the
substraction order of your vectors (in the plane definition), either you
switch where the inverse keyword is. Doing both at the same time is
confusing.

So, I'll write (didn't check with pov but seems all right):

union
  {
  cone { Last, RLast, Current, RCurrent }
  cone { Current, RCurrent, Next, RNext }
  intersection
    {
    // moved everything to <0,0,0>: less code that way;
    // all is translated below with only one translate statement
    sphere { 0, RCurrent }
    union
      {
      difference // simpler than intersection + inverse
        {
        plane { Next-Current, 0 }
        plane { Current-Last, 0 }
        }
      difference // same as above with planes permutated
        {
        plane { Current-Last, 0 }
        plane { Next-Current, 0 }
        }
      }
    bounded_by { sphere { 0, RCurrent*1.00001 } }
    translate Current
    }
  }

>Hope this helps.
>Peter

Me too,

Philippe


Post a reply to this message

From: Peter Popov
Subject: Re: Help! Can anyone figure this math?
Date: 1 Sep 1998 01:38:25
Message: <35eb7a41.0@news.povray.org>
Well, I tried playing around with inverting the vectors and having inverse
on/off but this seemed to work, so I used it. Anyway, POV internally
represents a box as an intersection of six planes, but it is bounded and
uses vista buffers, so it's fast. Also, difference is internally represented
as intersection { ... inverse }, but using the former surely makes the code
more clear. Lastly, can you provide the math part of the code you're working
on once you're finished? I'm getting quite curious...

Peter


Post a reply to this message

From: Philippe Debar
Subject: Re: Help! Can anyone figure this math?
Date: 1 Sep 1998 15:22:42
Message: <35ec3b72.0@news.povray.org>
Hi

Peter Popov wrote in message <35eb7a41.0@news.povray.org>...
>(...) POV internally
>represents a box as an intersection of six planes, but it is bounded and
>uses vista buffers, so it's fast.
I didn't knew that. Well, I never looked inside pov... yet.

>Lastly, can you provide the math part of the code you're working
>on once you're finished? I'm getting quite curious...

Sure. Quoting myself:

<snip>
I am writing macros to do linear mouldings as well as collumns
relief, so I am after a general solution. But if you want, I can post or
email what I have already done. The file isn't very long, but is written
in a kind of franglais, with architectural terms my dictionnary can't
translate.
<snap>

Do you want me to email it to you? (I'd prefer that to posting it, as
it is not finished yet, with no exemples and no explanations).


Renderingly,

Philippe


Post a reply to this message

From: Ron Parker
Subject: Re: Help! Can anyone figure this math?
Date: 1 Sep 1998 16:03:33
Message: <35ec4505.0@news.povray.org>
On Tue, 1 Sep 1998 20:22:33 +0200, Philippe Debar
        <phi### [at] hotmailcom> wrote:
>Hi
>
>Peter Popov wrote in message <35eb7a41.0@news.povray.org>...
>>(...) POV internally
>>represents a box as an intersection of six planes, but it is bounded and
>>uses vista buffers, so it's fast.
>I didn't knew that. Well, I never looked inside pov... yet.

Well, it doesn't represent a box as six planes in the sense that it
represents a difference as an intersection with an inverse.  Boxes actually
have their own code to find intersections, do transformations, etc, and
there really is an object called a "box" in the POV code.  Search high and
low, though, and you won't find the term "difference" used outside the
parser.  Old versions of POV (circa 1.x?) used planes to make boxes, but
nothing recent does.


Post a reply to this message

From: Peter Popov
Subject: Re: Help! Can anyone figure this math?
Date: 1 Sep 1998 17:44:48
Message: <35ec5cc0.0@news.povray.org>
Philippe Debar wrote in message <35ec3b72.0@news.povray.org>...
>Hi
>
>Peter Popov wrote in message <35eb7a41.0@news.povray.org>...
>>(...) POV internally
>>represents a box as an intersection of six planes, but it is bounded and
>>uses vista buffers, so it's fast.
>I didn't knew that. Well, I never looked inside pov... yet.


Me neither, just guessing about the box stuff (that's how I would do it).
>
>>Lastly, can you provide the math part of the code you're working
>>on once you're finished? I'm getting quite curious...
>
>Sure. Quoting myself:
>
><snip>
>I am writing macros to do linear mouldings as well as collumns
>relief, so I am after a general solution. But if you want, I can post or
>email what I have already done. The file isn't very long, but is written
>in a kind of franglais, with architectural terms my dictionnary can't
>translate.
><snap>
>
>Do you want me to email it to you? (I'd prefer that to posting it, as
>it is not finished yet, with no exemples and no explanations).
>

E-mail is fine. I have 4.3 megs of disk quota to spend, so...

>
>Renderingly,
>
>Philippe
>

Cya.

Peter


Post a reply to this message

From: Alain CULOS
Subject: Re: Help! Can anyone figure this math?
Date: 5 Sep 1998 16:45:42
Message: <35F05231.66C45D58@bigfoot.com>
Philippe Debar wrote:

> >but I have a question: can't you use spheres to join
> >cones?
> Yes... but the torus and the sphere solutions handle different cases.
> With a sphere, you can join cones on different axis, you can't with
> a torus. My cones would be on the same axis. They could be joined
> smoothly by either adding a torus or removing a torus from a
> cylinder. You can't do that with a sphere.

You are after a simple problem for the scaled cylinder, but more complex for
the torus.

If you take :
point A, tangeant Ta,
point B, tangeant Tb,
Now intersect both tangeants from their respective origins and call this C.
Also intersect the line described by A, Tb with the one described by B, Ta, you
get a point that you name D.
ACBD is a parallelepiped into which your ellipse is inscribed.
D is the centre of the ellipse, you can now edit the matrix tranform for the
circle to become an ellipse : match one axis into DA and the other into DB, you
are done with it.

When you draw this solution on paper, you get a scaled and rotated ellipse
(there is no way out of that fate). So the answer for your torus is a bit more
complex but not much. The only problem is you cannot do it with a simple
transform, instead you have to write the equation down and use the quartic
object.

The ellipse above can be described by X^2+Y^2=1, where the X axis lies along DA
and the Y axis along DB, DA being one X unit long and DB being one Y unit long.

The transform for that is :
X=(x*(xa-xd)+y*(ya-yd)) / ((xa-xd)^2+(ya-yd)^2)^(1/2)
Y=(x*(xb-xd)+y*(yb-yd)) / ((xb-xd)^2+(yb-yd)^2)^(1/2)
Expand this into your X^2+Y^2=1 you get a wonderful equation.
Now substitute every occurance of x with (x^2+z^2)^(1/2) into this equation and
you get your wonderful torus equation. Make it so that you have no square
roots, only integer powers ranging from 0 to 4 and you can write that into your
quartic object.

I hope this helps, and have fun with the equations,
Al.

--
ANTI SPAM / ANTI ARROSAGE COMMERCIAL :
Pour me répondre, veuillez enlever le Z de mon adresse.
To answer me, please take out the Z from my address.


Post a reply to this message

From: Philippe Debar
Subject: Re: Help! Can anyone figure this math?
Date: 5 Sep 1998 18:18:16
Message: <35f1aa98.0@news.povray.org>
Thank you very much Alain, your answers will be very usefull. I like
the inscribing rectangle idea very much...

Would you know if this is the only answer, or one from a set of
solutions? This is not very important, it is only idle curiosity.

Thank you again


Povingly

Philippe


Post a reply to this message

From: Alain CULOS
Subject: Re: Help! Can anyone figure this math?
Date: 11 Sep 1998 18:50:34
Message: <35F4262E.C659F901@bigfoot.com>
Philippe Debar wrote:

> Thank you very much Alain, your answers will be very usefull.

You're more than welcome.(Useful only takes one 'l' by the way).


> I like the inscribing rectangle idea very much...

Well, parallelepiped, not rectangle.

> Would you know if this is the only answer, or one from a set of
> solutions ?

This has to be the only one because you give two points and two
tangeants, therefore there can only be one solution.

> This is not very important, it is only idle curiosity.

That is exactly what is good : curiosity.

> Thank you again

Welcome again.

> Povingly

And same back.

> Philippe

By the way, I'm French, so if you have a problem chating in English,
mail me up in your own language ;-)I just thougth this might benefit
others, so I kept it all the way in English.

Cheers,
Al.

--
ANTI SPAM / ANTI ARROSAGE COMMERCIAL :
Pour me répondre, veuillez enlever le Z de mon adresse.
To answer me, please take out the Z from my address.


Post a reply to this message

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