POV-Ray : Newsgroups : povray.general : Feature request - spliney cylinders - or howto model pipes Server Time
5 Nov 2024 13:24:54 EST (-0500)
  Feature request - spliney cylinders - or howto model pipes (Message 1 to 6 of 6)  
From: David Greaves
Subject: Feature request - spliney cylinders - or howto model pipes
Date: 20 Sep 1998 14:42:57
Message: <36053D37.868A081@telekinesys.co.uk>
Hi

This started with "How can I model a bendy pipe?"

I got sPatch, created a line with 10 points, lathed it (6 sides) and
then moved/rotated the hexagonal groups of points. The problem is that
this doesn't retain the pipe walls equidistant to the pipe's axis :(

I kinda fixed this by using three groups of hexagons around a bend so
the 'straight' bits were cylindrical but thats quite fiddly and not
accurate.

Then, some reading later I thought:
Wouldn't it be nice to have a spline that had thickness?
Maybe a blob spline? (but that would be too thick at the bends)
Maybe have a 'map' function to determine radius wrt distance along the
spline (assuming you can calculate the distance travelled along a spline
- my maths is not that good)
A function of '1' would then produce a bent cylinder - more interesting
functions would produce eg, a string of pearls....

Any other ideas for bendy pipes?

David


Post a reply to this message

From: Ronald L  Parker
Subject: Re: Feature request - spliney cylinders - or howto model pipes
Date: 20 Sep 1998 15:03:08
Message: <360542b9.224525622@news.povray.org>
On Sun, 20 Sep 1998 18:36:55 +0100, David Greaves
<dav### [at] telekinesyscouk> wrote:

>Hi
>
>This started with "How can I model a bendy pipe?"

You go to http://www2.fwi.com/~parkerr/traces.html and download the
wonderful torus spline .include file for POV 3.1 beta.  But of course
I'm biased.


Post a reply to this message

From: Ken
Subject: Re: Feature request - spliney cylinders - or howto model pipes
Date: 20 Sep 1998 15:30:24
Message: <36054A06.F2E420EF@pacbell.net>
David Greaves wrote:

> Hi
>
> This started with "How can I model a bendy pipe?"
>
> Any other ideas for bendy pipes?
>
> David

    I have used the #while loop function to create curved pipes.
It uses spheres (like your string of pearls} in a circular arc
to create the form. This method requires a lot of spheres to
get a smooth surface.
    A utility called CTDS or the Connect the Dots Smoother
takes a set of 3d point coordinates and connects the points with
cones and spheres for you. It will even tie a knot if you plot the
points correctly.
    Chris Colefax has an .inc file called bend.inc that will take
almost any declarable pov object and bend it in user definable
ways. The output isn't always predictable but that can be
fun too. His inc. works on the principal of the D'Jong box
where it intersects the object slicing it into many pieces
then it rotates them individualy and re-assymbles the whole
thing back into one piece.
    I have also intersected torus objects into pieces to
use as 45,90, and 180 degree bent pipes. They offer the
advantage of being perfectly smooth and the angle depends
on where you intersect it. Match the ends with a cylinder
the same diameter as the torus, carefully align it, and it
makes faily realistic plumbing, chair backs, and what have
you.

Ken


Post a reply to this message

From: David Greaves
Subject: Re: Feature request - spliney cylinders - or howto model pipes
Date: 20 Sep 1998 16:23:03
Message: <360554AF.48F1C964@telekinesys.co.uk>
Ronald and Ken

I'll go get traces.html, CTDS and bend.inc

I discounted torii (sp?) because I'm looking for a fairly free 3d bend.
A bit like a piece of string lying on a desk after you've wiggled it -
only in 3d!!

The pipes will only be a small part of a scene so #while-ing spheres
sounds a bit OTT.
(hey this is POV-day 3!!)

Meanwhile sPatch is looking OK for a prototype...

Nb, I just found Chris' todo page where he's planning spline generator
enhancements - timing or what?

Thanks for being friendly :)

David


Post a reply to this message

From: Thomas Willhalm
Subject: Re: Feature request - spliney cylinders - or howto model pipes
Date: 21 Sep 1998 04:39:04
Message: <qqm7lyx9ap1.fsf@goldach.fmi.uni-konstanz.de>
David Greaves <dav### [at] telekinesyscouk> writes:

> Hi
> 
> This started with "How can I model a bendy pipe?"
> 
> I got sPatch, created a line with 10 points, lathed it (6 sides) and
> then moved/rotated the hexagonal groups of points. The problem is that
> this doesn't retain the pipe walls equidistant to the pipe's axis :(
> 
> I kinda fixed this by using three groups of hexagons around a bend so
> the 'straight' bits were cylindrical but thats quite fiddly and not
> accurate.
> 
> Then, some reading later I thought:
> Wouldn't it be nice to have a spline that had thickness?
[...]

In my opinion, you are looking for "POV-Ray with Sphere Sweeps". It can
generate "splines with thickness". Besides the source code, binaries 
are available for Mac, Sun, and Linux at 
http://www.informatik.uni-bremen.de/~vader/pss/pss.html .
The page contains also a link to TMPov, a custom version of POV-Ray
for Win95/NT that includes this patch (and many others).

Thomas

-- 
http://www.fmi.uni-konstanz.de/~willhalm


Post a reply to this message

From: Gilles Tran
Subject: Re: Feature request - spliney cylinders - or howto model pipes
Date: 23 Sep 1998 13:19:32
Message: <36091FDF.1869F5AC@inapg.inra.fr>
Hi
Here a little bit of povray 3.1 code that could do the trick. Actually I
made it to model a fantasy tree trunk but it could be used (and largely
simplified and improved) for a lot of other purposes, including making
pipes. It takes a shape defined in the x-z plane and extrude it according to
a path defined by three macros (fx(j), fy(j),fz(j), j=0 to 1). You obtain a
triangle mesh (non-smoothed). Actually, it's more than extrusion because the
shape itself is modified along the path (I wanted the shape to be corrugated
and to be larger at the base) so macros are used  too to define the shape
according the current position in the path.

You can change the macros and obtain a different mesh. For a pipe, this
could be overkill, but since the resulting object is a mesh many copies of
it can be used in a scene without eating too much memory (and they render
fast). Use small step sizes for trial and large for final render (parsing
may be long).

This code could be enhanced by having a spline for the path and another
spline for the shape (volunteers ???). And triangle smoothing...

The final rendering is here http://www.inapg.inra.fr/dsa/essai/foret6.jpg

I hope this helps.

Gilles Tran
The Book of Beginnings - Povray Gallery
 http://www.ina.fr/Artichaud/Tran/gtran.en.html

===============================
#macro fx(j) // macro that defines the x path
(-10*j*j*j*j -22*j*j*j +21*j*j)/2
#end

#macro fy(j) // macro that defines the y path
j*40
#end

#macro fz(j) // macro that defines the z path
(-10*j*j*j*j -22*j*j*j +21*j*j)/2
#end

#macro fray(j) //macro that changes the radius (large at the base, near 3 at
the end)
exp(-16*j +3.7) + 2.7
#end

#macro fxSeg(j,r) //macro that defines the shape on the x axis
r*(sin(2*pi*j)*(1+(cos(2*pi*j*15)/30)))
#end

#macro fzSeg(j,r) //macro that defines the shape on the z axis
r*(cos(2*pi*j)*(1+(sin(2*pi*j*15)/30)))
#end

#declare iStep=0.01; // step size for the path hi-res
#declare iSegStep=0.002; // step size for the shape hi-res

//#declare iStep=0.03; // step size for the path low-res
//#declare iSegStep=0.03; // step size for the path low-res


#declare Arbre=mesh{
#declare iPath=0;
#while (iPath<1) // loop on path
#declare iPath2=iPath+iStep;
#declare iPath3=iPath2+iStep;

#declare r1=fray(iPath);
#declare r2=fray(iPath2);

#declare xP1=fx(iPath); // present point on the path
#declare yP1=fy(iPath);
#declare zP1=fz(iPath);

#declare xP2=fx(iPath2); // next point on the path
#declare yP2=fy(iPath2);
#declare zP2=fz(iPath2);

#declare xP3=fx(iPath3); // next next point on the path
#declare yP3=fy(iPath3);
#declare zP3=fz(iPath3);

#declare P1=<xP1,yP1,zP1>;
#declare P2=<xP2,yP2,zP2>;
#declare P3=<xP3,yP3,zP3>;

// vector calculation to rotate the shape along the P2-P1 vector (thanks
John Van Sickle !)
#declare yV1=vnormalize(P2-P1);
#declare xV1=vnormalize(vcross(yV1,z));
#declare zV1=vcross(xV1,yV1);

// vector calculation to rotate the shape along the P3-P2 vector
#declare yV2=vnormalize(P3-P2);
#declare xV2=vnormalize(vcross(yV2,z));
#declare zV2=vcross(xV2,yV2);

// shape definition
#declare iSeg=0;
#while (iSeg<1)
#declare iSeg2=iSeg+iSegStep;
#declare x1=fxSeg(iSeg,r1);
#declare y1=0;
#declare z1=fzSeg(iSeg,r1);

#declare x1s=fxSeg(iSeg2,r1);
#declare y1s=0;
#declare z1s=fzSeg(iSeg2,r1);

#declare x2=fxSeg(iSeg,r2);
#declare y2=0;
#declare z2=fzSeg(iSeg,r2);

#declare x2s=fxSeg(iSeg2,r2);
#declare y2s=0;
#declare z2s=fzSeg(iSeg2,r2);

// rotates the 4 points that will make the 2 triangles
#declare posV1=<x1*xV1.x + y1*yV1.x + z1*zV1.x + P1.x, x1*xV1.y + y1*yV1.y +
z1*zV1.y + P1.y, x1*xV1.z + y1*yV1.z + z1*zV1.z + P1.z>;
#declare posV2=<x2*xV2.x + y2*yV2.x + z2*zV2.x + P2.x, x2*xV2.y + y2*yV2.y +
z2*zV2.y + P2.y, x2*xV2.z + y2*yV2.z + z2*zV2.z + P2.z>;
#declare posV1s=<x1s*xV1.x + y1s*yV1.x + z1s*zV1.x + P1.x,x1s*xV1.y +
y1s*yV1.y + z1s*zV1.y + P1.y, x1s*xV1.z + y1s*yV1.z + z1s*zV1.z + P1.z>;
#declare posV2s=<x2s*xV2.x + y2s*yV2.x + z2s*zV2.x + P2.x, x2s*xV2.y +
y2s*yV2.y + z2s*zV2.y + P2.y, x2s*xV2.z + y2s*yV2.z + z2s*zV2.z + P2.z>;

triangle{posV1,posV2,posV1s}
triangle{posV1s,posV2,posV2s}

#declare iSeg= iSeg + iSegStep; // next point on the shape
#end

#declare iPath=iPath2; // next point on the path
#end
}


David Greaves wrote:

> Hi
>
> This started with "How can I model a bendy pipe?"
>
> I got sPatch, created a line with 10 points, lathed it (6 sides) and
> then moved/rotated the hexagonal groups of points. The problem is that
> this doesn't retain the pipe walls equidistant to the pipe's axis :(
>
> I kinda fixed this by using three groups of hexagons around a bend so
> the 'straight' bits were cylindrical but thats quite fiddly and not
> accurate.
>
> Then, some reading later I thought:
> Wouldn't it be nice to have a spline that had thickness?
> Maybe a blob spline? (but that would be too thick at the bends)
> Maybe have a 'map' function to determine radius wrt distance along the
> spline (assuming you can calculate the distance travelled along a spline
> - my maths is not that good)
> A function of '1' would then produce a bent cylinder - more interesting
> functions would produce eg, a string of pearls....
>
> Any other ideas for bendy pipes?
>
> David


Post a reply to this message

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