|
|
In article <$SIn### [at] econymdemoncouk>,
Mike Williams <nos### [at] econymdemoncouk> wrote:
> On my machine, your code still doesn't exhibit the problem that you had
> on the left edge. Are you perhaps using an old version of the spline
> macro?
>
> On my machine it looks good if I just make the changes that Steve and I
> said earlier:
>
> 1. Remove the two spurious points from the MySplinePoints array
>
> 2. Change the step size so that you get an even whole number of links
>
> 3. Scale your link_object down by "scale 0.625".
>
> The points where the links should touch in your object are at x=0.8 and
> x=-0.8 (the links should touch on the inside edge of the half torus) but
> link_spline requires the touch points to be at x=0.5 and x=-0.5. So
> scale your link by five eighths.
thanks you. i follow yours advices. some progress but still one problem.
// --------------------------------------------------------------------------
// Persistence Of Vision raytracer version 3.5 sample file.
// --------------------------------------------------------------------------
#version unofficial MegaPov 1.0;
// --------------------------------------------------------------------------
#include "colors.inc"
// #include "personal.inc"
#include "math.inc"
#include "transforms.inc"
#include "spline.inc"
// --------------------------------------------------------------------------
// --- SCENE ----------------------------------------------------------------
// --------------------------------------------------------------------------
camera {
location <2,12-2,-10+2>
// location p2r(284.036, 50.490, 12.961,false)
look_at <0,2,3>
}
sky_sphere {
pigment {
planar
poly_wave 2
color_map {
[0.0, color <0.2,0.5,1.0>]
[1.0, color <0.8,0.9,1.0>]
}
}
}
light_source {< 1,2,-2>*1000, color 1.0}
light_source {<-1,2, 1>*1000, color 0.7 shadowless}
plane { // checkered plane
y, -1
pigment {
checker White, White*0.90
scale 5
}
}
// --------------------------------------------------------------------------
// The original spline
// --------------------------------------------------------------------------
//#declare MySpline = spline {
// cubic_spline
// -2, <-5, 3, 0>, // control point
// -1, <-2, 2, 0>, // control point
// 00, < 0, 2, 0>, // start
// 01, < 0, 2, 0>,
// 02, < 5, 3, 0>, // through yellow ring
// 03, < 5, 4, 4>,
// 04, < 0, 5, 5>, // around
// 05, <-2, 4, 9>, // the
// 06, < 2, 3, 9>, // green
// 07, < 0, 2, 5>, // pole
// 08, <-5, 2, 4>,
// 09, <-5, 3, 0>, // through blue ring
// 10, <-2, 2, 0>,
// 11, < 0, 2, 0>, // stop
// 12, < 2, 2, 0>, // control point
// 13, < 5, 3, 0>, // control point
// }
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// 1. remove the two spurious points
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
#declare MySplinePoints = array [14]
// #declare MySplinePoints[0] =<-5, 3, 0>;
#declare MySplinePoints[0] =<-2, 2, 0>;
#declare MySplinePoints[1] =< 0, 2, 0>;
#declare MySplinePoints[2] =< 0, 2, 0>;
#declare MySplinePoints[3] =< 5, 3, 0>;
#declare MySplinePoints[4] =< 5, 4, 4>;
#declare MySplinePoints[5] =< 0, 5, 5>;
#declare MySplinePoints[6] =<-2, 4, 9>;
#declare MySplinePoints[7] =< 2, 3, 9>;
#declare MySplinePoints[8] =< 0, 2, 5>;
#declare MySplinePoints[9] =<-5, 2, 4>;
#declare MySplinePoints[10] =<-5, 3, 0>;
#declare MySplinePoints[11] =<-2, 2, 0>;
#declare MySplinePoints[12] =< 0, 2, 0>;
#declare MySplinePoints[13] =< 2, 2, 0>;
// #declare MySplinePoints[15] =< 5, 3, 0>;
#declare MySpline = create_spline (MySplinePoints, create_cubic_spline)
// --------------------------------------------------------------------------
// link object
// --------------------------------------------------------------------------
#declare majorRadius = 0.50;
#declare minorRadius = 0.20;
#declare linkLen = 1.00;
#declare halfTorus = difference {
torus { majorRadius, minorRadius }
plane { x, 0}
}
#declare maillon = union {
object { halfTorus translate linkLen*x }
object { halfTorus rotate 180*y }
cylinder { <0.00, 0.00, +majorRadius> <linkLen, 0.00, +majorRadius>
minorRadius }
cylinder { <0.00, 0.00, -majorRadius> <linkLen, 0.00, -majorRadius>
minorRadius }
translate -linkLen*0.50*x
}
#declare link_object = object {
maillon
pigment { color White*0.60 }
finish { reflection 0.2 specular 0.8 metallic}
}
// --------------------------------------------------------------------------
#declare link_objectMax = max_extent(link_object);
#declare link_objectMin = min_extent(link_object);
#debug "\n\n"
#debug concat("\n>> max : x = ",str(link_objectMax.x,6,4)," y =
",str(link_objectMax.y,6,4)," z = ",str(link_objectMax.z,6,4))
#debug concat("\n>> min : x = ",str(link_objectMin.x,6,4)," y =
",str(link_objectMin.y,6,4)," z = ",str(link_objectMin.z,6,4))
#declare linkTouch = link_objectMax.x-2*minorRadius;
#debug concat("\n>> linkTouch = ",str(linkTouch,6,4))
#declare scaling = 0.50/linkTouch;
#debug concat("\n>> scaling = ",str(scaling,6,4))
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// 3. scale your link_object down
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
#set link_object = object { link_object scale scaling }
#declare splineLen = spline_length(MySpline);
#debug concat("\n>> splineLen = ",str(splineLen,8,3))
#declare splineStep = splineLen/int(splineLen);
#debug concat("\n>> splineStep = ",str(splineStep,8,3))
#declare number_of_link = splineLen/splineStep;
#debug concat("\n>> number_of_link = ",str(number_of_link,8,3))
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// 2. Change the step size so that you get en even whole number of links
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
#set number_of_link = (mod(number_of_link,2)=0 ? number_of_link :
number_of_link+1);
#debug concat("\n>> modified number_of_link = ",str(number_of_link,8,3)," <- an
even whole number !")
#set splineStep = splineLen/number_of_link;
#debug concat("\n>> new splineStep = ",str(splineStep,8,3),"\n\n")
link_spline (MySpline, spline_step_size(splineStep)+spline_step_twist(90))
// --------------------------------------------------------------------------
Post a reply to this message
Attachments:
Download 'in_progress.jpg' (30 KB)
Preview of image 'in_progress.jpg'
|
|