home *** CD-ROM | disk | FTP | other *** search
- rem **************************************************************
- rem This is a CADL file to create the points for an offset spline.
- rem Presently set up for 2-D and 3-D Cubic splines.
- rem Offset points will be produced at the knot points
- rem of the selected spline. These points can then be joined
- rem to produce the required spline.
- rem This routine will work for a closed spline. Note that
- rem checks have not been included to ensure the offset is
- rem always on the correct side. This shortfall can be overcome by
- rem running the routine twice and asking for a positive
- rem as well as a negative offset.
- rem **************************************************************
- :select
- set mask, 5
- getent "Select the SPLINE you want to offset", enttype
- if enttype != 5
- goto select
- deft = 0.25
- getflt "Enter the OFFSET required (%f) =>",deft,thick
- if @intdat[8] == 0
- goto dim2
- if @intdat[8] == 1
- goto dim3
- pause "SPLINE type selected is not supported. PRESS RETURN"
- goto exit
- :dim2
- pause "2-D SPLINE selected with %d segments.PRESS RETURN", @intdat[11]
- i=0
- j=0
- col =@color + 1
- lev =@level + 1
- levels 1, lev
- :loop1
- i=i+1
- if i >@intdat[11]
- goto lab1
- :loop2
- k1=j + 8*(i-1)
- A=@fltdat[k1]
- k2=j+1+8*(i-1)
- B=@fltdat[k2]
- k3=j+2+8*(i-1)
- C=@fltdat[k3]
- k4=j+3+8*(i-1)
- D=@fltdat[k4]
- k5=j+4+8*(i-1)
- E=@fltdat[k5]
- k6=j+5+8*(i-1)
- F=@fltdat[k6]
- k7=j+6+8*(i-1)
- G=@fltdat[k7]
- k8=j+7+8*(i-1)
- H=@fltdat[k8]
- x1=D
- y1=H
- if C==0.0
- goto zero
- dydx1=G/C
- goto cont
- :zero
- ang=90.0
- goto jump
- :cont
- ang=atan(dydx1)
- :jump
- x1new = x1 - thick*sin(ang)
- y1new = y1 + thick*cos(ang)
- POINT x1new, y1new, @depth, col, lev, 0, 0, 0
- if i == @intdat[11]
- goto loop3
- goto loop1
- :loop3
- x2=A + B + C + D
- y2=E + F + G + H
- den=(3.0*A+2.0*B+C)
- if den==0.0
- goto zero1
- dydx2= (3.0*E + 2.0*F + G)/(3.0*A + 2.0*B + C)
- goto cont1
- :zero1
- ang=90.0
- goto jump1
- :cont1
- ang=atan(dydx2)
- :jump1
- x2new= x2 - thick*sin(ang)
- y2new= y2 + thick*cos(ang)
- POINT x2new, y2new, @depth, col, lev, 0, 0, 0
- goto exit
- :dim3
- pause "3-D SPLINE selected with %d segments.PRESS RETURN", @intdat[11]
- i=0
- j=0
- col =@color + 1
- lev =@level + 1
- levels 1, lev
- :loop10
- i=i+1
- if i >@intdat[11]
- goto lab1
- :loop20
- k1=j + 12*(i-1)
- A=@fltdat[k1]
- k2=j+1+12*(i-1)
- B=@fltdat[k2]
- k3=j+2+12*(i-1)
- C=@fltdat[k3]
- k4=j+3+12*(i-1)
- D=@fltdat[k4]
- k5=j+4+12*(i-1)
- E=@fltdat[k5]
- k6=j+5+12*(i-1)
- F=@fltdat[k6]
- k7=j+6+12*(i-1)
- G=@fltdat[k7]
- k8=j+7+12*(i-1)
- H=@fltdat[k8]
- k9=j+8+12*(i-1)
- M=@fltdat[k9]
- k10=j+9+12*(i-1)
- N=@fltdat[k10]
- k11=j+10+12*(i-1)
- O=@fltdat[k11]
- k12=j+11+12*(i-1)
- P=@fltdat[k12]
- x1=D
- y1=H
- z1=P
- if C==0.0
- goto zero2
- dydx1=G/C
- goto cont2
- :zero2
- ang=90.0
- goto jump2
- :cont2
- ang=atan(dydx1)
- :jump2
- x1new = x1 - thick*sin(ang)
- y1new = y1 + thick*cos(ang)
- POINT x1new, y1new, z1, col, lev, 0, 0, 0
- if i == @intdat[11]
- goto loop30
- goto loop10
- :loop30
- x2=A + B + C + D
- y2=E + F + G + H
- z2=M + N + O + P
- den=(3.0*A+2.0*B+C)
- if den==0.0
- goto zero3
- dydx2= (3.0*E + 2.0*F + G)/(3.0*A + 2.0*B + C)
- goto cont3
- :zero3
- ang=90.0
- goto jump3
- :cont3
- ang=atan(dydx2)
- :jump3
- x2new= x2 - thick*sin(ang)
- y2new= y2 + thick*cos(ang)
- POINT x2new, y2new, z2, col, lev, 0, 0, 0
- :lab1
- :exit