home *** CD-ROM | disk | FTP | other *** search
- /*
- This genie edits the positions & curvature of points. Click on the points you want to convert, then on a blank place to stop.
-
- Written by Don Cox, Apr. '94. Copyright. Not Public Domain.
- */
- /* $VER: EditPoints Apr 94 */
-
- trace r
-
- if ~show("l", "gdarexxsupport.library") then
- if ~addlib("gdarexxsupport.library", 0, -30,0) then do
- call ppm_Inform(1,"Please install the gdarexxsupport.library in your libs: directory before running this Genie.")
- end
- call pdm_AutoUpdate(0)
- numeric digits 10
- cr = "0a"x
-
- do i = 1 to 50 /* safety limit */
- clickpos = pdm_ClickOnPoint(" Click on the Points to be changed...")
- if clickpos = "0 0" then exit_msg()
-
- object = word(clickpos, 1)
- point = word(clickpos, 2)
- pointinfo = pdm_GetPoint(object,point)
- parse var pointinfo Xpos Ypos tangent1X tangent1Y tangent2X tangent2Y
- radius1 = trunc(squareroot((tangent1X**2)+(tangent1Y**2)),4)
- radius2 = trunc(squareroot((tangent2X**2)+(tangent2Y**2)),4)
- sharpness = (radius1+radius2)/2
- if sharpness = 0 then sharpness = "C"
- else sharpness = "S"
- form = "Position X:"Xpos ||cr|| "Position Y:"Ypos ||cr|| "Tangent A length:"radius1 ||cr|| "Tangent B length:"radius2 ||cr|| "Rotate (degrees):0" ||cr|| "Delete/Cut/Leave:L" ||cr|| "Smooth/Corner (S/C):"sharpness
- form = pdm_GetForm("Edit point "point" on object "object, 18,form)
- if form = "" then exit_msg("Cancelled")
- parse var form newXpos "0a"x newYpos "0a"x newradius1 "0a"x newradius2 "0a"x rotation "0a"x butcher "0a"x newsharpness
- if ~(datatype(newXpos,n) & datatype(newYpos,n) & datatype(newradius1,n) & datatype(newradius2,n) & datatype(rotation,n)) then exit_msg("Invalid entry")
- newsharpness = upper(strip(newsharpness))
- if newsharpness~="C" then newsharpness = "S"
- sharpset = 1.0
- if newsharpness = "C" then sharpset = 0
-
- if (newXpos~=Xpos | newYpos~=Ypos) then call pdm_SetPoint(object, point, newXpos newYpos )
- if newsharpness~=sharpness then call pdm_SmoothPoint(object, point, sharpset)
- if (newradius1~=radius1 | newradius2~=radius2) then call pdm_SetPointRadius(object, point, newradius1,newradius2)
- if rotation~=0 then call pdm_RotatePoint(object,point,rotation)
-
- if upper(strip(butcher))="D" then call pdm_RemovePoint(object,point)
- if upper(strip(butcher))="C" then call pdm_CutAtPoint(object,point)
-
- call pdm_UpdateScreen(1)
-
- end
-
- exit_msg()
-
-
- /* +++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++ */
-
- squareroot: /* to avoid bug in gdarexxsupport.library sqrt function */
- parse arg number
-
- removed = remlib("gdarexxsupport.library")
- if removed~=1 then call ppm_Inform(1,"Could not remove gdarexxsupport.library calculations may be faulty","Resume")
-
- /* rexxmathlib.library is needed instead */
- if ~show("l", "rexxmathlib.library") then
- if ~addlib("rexxmathlib.library", 0, -30,0) then do
- call ppm_Inform(1,"Please install the rexxmathlib.library in your libs: directory before running this Genie.")
- end
-
- number = sqrt(number)
-
- if ~show("l", "gdarexxsupport.library") then
- if ~addlib("gdarexxsupport.library", 0, -30,0) then do
- call ppm_Inform(1,"Please install the gdarexxsupport.library in your libs: directory before running this Genie.")
- end
-
-
- return number
-
- /* +++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++ */
- /* +++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++ */
-
- exit_msg: procedure expose units
- do
- parse arg message
-
- if message ~= '' then call pdm_Inform(1,message,)
- call pdm_AutoUpdate(1)
- exit
- end
-