POV-Ray : Newsgroups : povray.general : Help! Can anyone figure this math? Server Time
13 Aug 2024 17:23:01 EDT (-0400)
  Help! Can anyone figure this math? (Message 13 to 22 of 22)  
<<< Previous 10 Messages Goto Initial 10 Messages
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 :

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 :

To answer me, please take out the Z from my address.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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