POV-Ray : Newsgroups : povray.general : rolled up maps : Re: rolled up maps Server Time
1 Aug 2024 08:23:56 EDT (-0400)
  Re: rolled up maps  
From: Trevor G Quayle
Date: 16 Jan 2006 12:30:00
Message: <web.43cbd6f7743ed8aa6c4803960@news.povray.org>
> The problem actually is that the spline control points are no evenly
> spaced. I used control points from 0.0 to 0.5 for the rolled area at one
> end, and control points 0.5002 to 1.0 for the rolled area at the other
> end. I hadn't realized that the uv mapping would follow the control
> point spacing.

didn't notice it was a spline, but same concept

>
> The whole thing would need to be redesigned to have control points that
> are evenly distributed along the spline. It turns out to be quite tricky
> to write it so that the spline is generated with evenly spaced control
> points.
>
> Is there a utility that will take a spline and reorganize the control
> points to be evenly spread without changing the shape?

try this procedural version I put together for you, gives approximately
equal spacing for the control points:

//start

#declare MapLen = 300; //overall length of map
#declare LLen = 150;   //length rolled up at left
#declare RLen = 100;   //length rolled up at right
#declare MLen = MapLen-LLen-RLen; //flat secton in middle

#declare RL= 10; //outer radius of left roll
#declare SL= 1;  //spacing between roll layers on left
#declare RR= 7;  //outer radius of right roll
#declare SR= 1.5;//spacing between roll layers on right

#declare MeshSiz = 1; //mesh spacing

#declare nL = int(LLen/MeshSiz);  //number segments left
#declare nM = int(MLen/MeshSiz);  //number segments middle
#declare nR = int(RLen/MeshSiz);  //number segments right


#declare LPts =array[nL+1+nM+1+nR+1][2]

#declare R=RL;
#declare Ang=180;

#declare i=0; #while (i<nL) //generate left hand points
  #declare dAng=180*MeshSiz/(pi*R);
  #declare Ang=Ang+dAng;
  #declare R=R-SL*dAng/360;
  #declare LPts[(nL-1)-i][0]=R*sin(radians(Ang));
  #declare LPts[(nL-1)-i][1]=R*cos(radians(Ang))+RL;
#declare i=i+1; #end

#declare i=0; #while (i<=nM) //generate middle points
  #declare LPts[nL+i][0]=i*MeshSiz;
  #declare LPts[nL+i][1]=0;
#declare i=i+1; #end

#declare R=RR;
#declare Ang=180;

#declare i=0; #while (i<nR) //generate right hand points
  #declare dAng=180*MeshSiz/(pi*R);
  #declare Ang=Ang-dAng;
  #declare R=R-SR*dAng/360;
  #declare LPts[nL+nM+i+1][0]=R*sin(radians(Ang))+MLen;
  #declare LPts[nL+nM+i+1][1]=R*cos(radians(Ang))+RR;
#declare i=i+1;#end

// An open 2D spline
#declare S = function {
   spline {
     linear_spline
     #declare T=0;
     #while (T<=1)
       #declare X=LPts[T*(nL+nM+nR)][0];
       #declare Y=LPts[T*(nL+nM+nR)][1];
       T, <X,Y>,
       #declare T=T+1/(nL+nM+nR);
     #end
   }
 }
//end



-tgq


Post a reply to this message

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