POV-Ray : Newsgroups : povray.general : Help! Can anyone figure this math? : Re: Help! Can anyone figure this math? Server Time
13 Aug 2024 13:23:28 EDT (-0400)
  Re: Help! Can anyone figure this math?  
From: Peter Popov
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

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