POV-Ray : Newsgroups : povray.newusers : Laying cables Server Time
3 Sep 2024 10:16:05 EDT (-0400)
  Laying cables (Message 1 to 7 of 7)  
From: Ekki Plicht
Subject: Laying cables
Date: 4 Feb 2005 18:51:39
Message: <42040a8b@news.povray.org>
Hi,
not exactly new to povray, but not very much experience...

I have a scene where I have two points in space which I want to connect with
a cable. The points are (can be) absolute random in space, the orientation
from which direction the cable enters the point is also random.

The cable should follow a gentle, elegant curve from one point to the other,
giving it a natural look of a quite rigid, not very supple cable. (As a
matter of fact it's a coaxial cable, abt. 10mm thick in reality).

I know I can use a sphere_sweep in general, but how do I calculate the
points to follow from one point to another?


TIA,
Ekki, Germany


Post a reply to this message

From: Tim Nikias
Subject: Re: Laying cables
Date: 4 Feb 2005 19:02:21
Message: <42040d0d$1@news.povray.org>
> I know I can use a sphere_sweep in general, but how do I calculate the
> points to follow from one point to another?

Well, I've never really used sphere_sweeps or the internal splines at all.
Once I wrote my Bezier-Spline-Macros for 3.1g or such, I've used them ever
since. I find the bicubic bezier-splines easy to visualize. If you want to,
just have a look, it's on my webpage in the downloads-section:
http://www.nolights.de

Still, splines are generally just a method of somehow interpolating a set of
points to a smooth curve. In your case, you might want to convert the
directions to points, e.g.
Starting_Point, Starting_Point+Direction_1, End_Point, End_Point-Direction_2

Plug those four points into an appropriate spline, and there you go! Well,
okay, that's just a very rough outline, but that's basically what you need
to do if you want to use POV-Ray's splines.

Regards,
Tim

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

From: Mike Williams
Subject: Re: Laying cables
Date: 4 Feb 2005 21:32:10
Message: <+FU8eEAo+CBCFwdX@econym.demon.co.uk>
Wasn't it Ekki Plicht who wrote:
>Hi,
>not exactly new to povray, but not very much experience...
>
>I have a scene where I have two points in space which I want to connect with
>a cable. The points are (can be) absolute random in space, the orientation
>from which direction the cable enters the point is also random.
>
>The cable should follow a gentle, elegant curve from one point to the other,
>giving it a natural look of a quite rigid, not very supple cable. (As a
>matter of fact it's a coaxial cable, abt. 10mm thick in reality).
>
>I know I can use a sphere_sweep in general, but how do I calculate the
>points to follow from one point to another?

A cable suspended between two points should follow a catenary curve. The
following code draws such a curve between two arbitrary points.

What it doesn't handle is the requirement that the cable ends are in a
random direction.


#version 3.6;
global_settings {assumed_gamma 1.0}
camera {location  <2,1.5,-10> look_at <2,1.5,2.5> angle 20}
background {rgb 1}
light_source {<-30, 100, -30> color rgb 1}

// ----------------------------------------

#declare Start=<1,2,3>; // Start point
#declare End=<3,1,2>;   // End Point
#declare Steps=50;      // Number of sphere_swwp points
#declare Slack=5;       // Slackness of the cable
#declare R=0.05;        // Radius of the cable

sphere_sweep {
  linear_spline
  Steps+1,
  #declare N=0;
  #declare X=Start.x;
  #while (N<=Steps)
    #declare Z = Start.z*(1-N/Steps) + End.z*(N/Steps);
    #declare Y1 = Start.y*(1-N/Steps) + End.y*(N/Steps);
    #declare Y2 = cosh(N/Steps - 0.5)-cosh(0.5);
    #declare Y=Y1+Y2*Slack;
    <X, Y, Z>,R
    #declare X=X+(End.x-Start.x)/Steps;
    #declare N=N+1;
  #end
  pigment {rgb x}
}

sphere{Start,0.1 pigment {rgb y}}
sphere{End,0.1 pigment {rgb y}}



-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Bernard Hatt
Subject: Re: Laying cables
Date: 4 Feb 2005 22:56:39
Message: <420443FC.D5EE6851@arkady.demon.co.uk>
Mike Williams wrote:
> A cable suspended between two points should follow a catenary curve. The
> following code draws such a curve between two arbitrary points.
> 
> What it doesn't handle is the requirement that the cable ends are in a
> random direction.

I had a similar macro which uses a cubic spline, you could modify the
1st and last vectors for the spline to change the directions of the end.

#version 3.6;
global_settings {assumed_gamma 1.0}
camera {location  <2,1.5,-10> look_at <2,1.5,2.5> angle 20}
background {rgb 1}
light_source {<-30, 100, -30> color rgb 1}

// ----------------------------------------

#macro rope(rstart,rend,rdrop,rad)
sphere_sweep
{
    cubic_spline,
    5,
    (rstart*2-rend)+<0,rdrop*4,0>, rad
    rstart, rad
    (rstart+rend)/2-<0,rdrop,0>, rad
    rend, rad
    (rend*2-rstart)+<0,rdrop*4,0>, rad
    pigment {rgb x+y}
}
#end

#declare Start=<1,2,3>; // Start point
#declare End=<3,1,2>;   // End Point
#declare Steps=50;      // Number of sphere_swwp points
#declare Drop=0.666;    // Drop at center of span
#declare R=0.05;        // Radius of the cable

rope(Start,End,Drop,R)

sphere{Start,0.1 pigment {rgb y}}
sphere{End,0.1 pigment {rgb y}}

---

Regards,

Bernard


Post a reply to this message

From: Ekki Plicht
Subject: Re: Laying cables
Date: 5 Feb 2005 16:47:25
Message: <42053eec@news.povray.org>
Mike Williams wrote:

> Wasn't it Ekki Plicht who wrote:
>>I have a scene where I have two points in space which I want to connect
>>with a cable. The points are (can be) absolute random in space, the
>>orientation from which direction the cable enters the point is also
>>random.

Thanks for the help, also to Bernard.

To illustrate what I am looking for please see povray.binaries.images,
"Antennas & missing cable".

The routine you posted gave me some ideas, but I still don't get it.

What I need is a cable connecting the two bright red cable ends already
shown in the picture. The vectors of these points are known, but as you can
see they are neither in origin nor in the same plane.
The cable should go from the vertical part still somewhat lower, then gently
curve upward until horizontal and join the other end. Later on a second
similiar cable is to be added to the other side.

My guess is I need something like a 3/4 circle, slightly bent out of a
plane. Something like a small part of a spiral. Now I know how to make
spirals (I think), but how do I tell it which two points to join in what
direction?

Thanks,
Ekki


Post a reply to this message

From: Sherry Shaw
Subject: Re: Laying cables
Date: 5 Feb 2005 20:27:21
Message: <42057279@news.povray.org>
Ekki Plicht wrote:

> What I need is a cable connecting the two bright red cable ends already
> shown in the picture.

Have you tried Chris Colefax's "link.inc"?  It sounds as though that might be 
what you need.  It's at http://tinyurl.com/3ths8 -- look for "link.zip."

--Sherry Shaw

-- 
#macro T(E,N)sphere{x,.4rotate z*E*60translate y*N pigment{wrinkles scale
.3}finish{ambient 1}}#end#local I=0;#while(I<5)T(I,1)T(1-I,-1)#local I=I+
1;#end camera{location-5*z}plane{z,37 pigment{granite color_map{[.7rgb 0]
[1rgb 1]}}finish{ambient 2}}//                                   TenMoons


Post a reply to this message

From: bancquart sebastien
Subject: Re: Laying cables
Date: 8 Mar 2005 11:46:42
Message: <422dd6f2@news.povray.org>
If you want something REALISTIC, the solution is in the cosh function. 
Spirals, bicubic splines and others are approximations, cosh is the Real 
curve.


Post a reply to this message

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