home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 5
/
DATAFILE_PDCD5.iso
/
utilities
/
_
/
3deditor
/
!3DEditor
/
Modules
/
Sweep
/
Module
(
.txt
)
next >
Wrap
RISC OS BBC BASIC V Source
|
1994-01-07
|
9KB
|
323 lines
Sweep Module
0,"To use this module run the !3DEditor application"
sweep_info
1ModulePurpose$="Create objects of revolution"
#ModuleAuthor$="Simon Wilkinson"
sweep_menuwarning:=0
sweep_closed(b%):=0
sweep_priority:=105
sweep_initialise(data%)
PutStr(data%,"sweep")
!data%=0
data%+=4
S="-type creator -items 1 -version 1.13 -variables -windows -atleast 2.15 -info"
sweep_windows(
IndrPos%,task%)
<Sweep_Ybox%=
Window_Create("ybox",IndrPos%,Block%,task%)
Window_Writeable(Sweep_Ybox%,8,10,4)
Block%!0=8:Block%!4=2
Block%!8=9:Block%!12=2
Block%!16=10:Block%!20=2
7Block%!24=-1:
Window_ActiveIcon(Sweep_Ybox%,Block%)
sweep_variables
SweepList(50,3)
sweep_toolclick(tool$,num%):=1
sweep_toolstart(tool$,num%)
Display_Claim("Sweeping")
Display_ClaimGrid
Display_StartDrawing
Display_Move(0,-MainYWidth%/2)
Display_Draw(0,MainYWidth%/2)
Display_EndDrawing
Wimp_NewPointer("ptr_cross",7,7)
ClickedOn%=-1
ClickedSide%=-1
Selected%>-1
(Select_Type%=8
Select_Type%=10)
Sweep_Exists%=Selected%
sweep_existing
Sweep_Exists%=-1
Sweep_TwoSided%=
SweepPos%=0
Window_NewYbox(Sweep_Ybox%,
Icon_UpState(Sweep_Ybox%,18,0)
Icon_UpState(Sweep_Ybox%,19,0)
Icon_UpState(Sweep_Ybox%,20,0)
NodesOn%=
Icon_UpText(Sweep_Ybox%,8,"360")
Icon_UpText(Sweep_Ybox%,9,"10")
Icon_UpText(Sweep_Ybox%,10,"0")
sweep_toolend(tool$,num%)
Wimp_OldPointer("ptr_cross")
Window_LooseYbox(Sweep_Ybox%)
Display_LoseCursor
Display_ReleaseGrid
Display_Release
sweep_click(win%,icon%,x%,y%,button%)
d%,dum%,ok%,o%
CurrentMain%
button%
ClickedOn%=-1
Display_LoseCursor
Display_ConvXY(x%,y%)
G ok%=
:ClickedSide%=0
Sweep_TwoSided%
:ClickedSide%=1
o%=ClickedSide%*2
loop%=0
SweepPos%-1
(SweepList(loop%,0+o%)-x%)<8
(SweepList(loop%,1+o%)-y%)<8
ClickedOn%=loop%
ClickedOn%=-1
sweep_addpoint(ClickedSide%)
Display_SnapToClaimedGrid(x%,y%)
ClickedOn%=-1
SweepList(SweepPos%,0)=x%
SweepList(SweepPos%,2)=-x%
SweepList(SweepPos%,0)=-x%
SweepList(SweepPos%,2)=x%
SweepList(SweepPos%,1)=y%
SweepList(SweepPos%,3)=y%
ClickedOn%=SweepPos%
SweepPos%+=1
sweep_redraw
sweep_redraw
%100*16
ClickedOn%<>-1
Drag_StartLines
o%=ClickedSide%*2
ClickedOn%<>0
Drag_Move(SweepList(ClickedOn%-1,0+o%),SweepList(ClickedOn%-1,1+o%))
Drag_Draw(&FFFF,&FFFF)
Drag_Move(&FFFF,&FFFF)
ClickedOn%<>SweepPos%-1
Drag_Draw(SweepList(ClickedOn%+1,0+o%),SweepList(ClickedOn%+1,1+o%))
Drag_Node2(&FFFF,&FFFF)
Drag_Node(&FFFF,&FFFF)
s?x%=SweepList(ClickedOn%,0+o%):y%=SweepList(ClickedOn%,1+o%)
Display_Screen(x%,y%)
Drag_Ready(x%,y%,1,
Sweep_Ybox%
icon%
{.Sweep_Rotation%=
Icon_Read(Sweep_Ybox%,8)
|+Sweep_Faces%=
Icon_Read(Sweep_Ybox%,9)
}-Sweep_Yshift%=
Icon_Read(Sweep_Ybox%,10)
sweep_go
Tool_Clear
Tool_Clear
ClickedOn%<>-1
ClickedSide%=0
sweep_deletepoint(ClickedOn%)
Icon_UpState(win%,16,0)
sweep_circle
Icon_UpState(win%,17,0)
$Sweep_TwoSided%=
Sweep_TwoSided%
ClickedSide%=0
sweep_copysides
sweep_redraw
Icon_GreyOut(Sweep_Ybox%,8,Sweep_TwoSided%
Icon_GreyOut(Sweep_Ybox%,10,Sweep_TwoSided%
Icon_UpText(Sweep_Ybox%,8,"360")
Icon_UpText(Sweep_Ybox%,9,"10")
ClaimGridOn%=
ClaimGridOn%
sweep_redraw
&ClaimSnapToGrid%=
ClaimSnapToGrid%
sweep_dragged(num%,x%,y%,z%)
CursorOn%=
Display_ConvXY(x%,y%)
Display_SnapToClaimedGrid(x%,y%)
o%=ClickedSide%*2
!SweepList(ClickedOn%,0+o%)=x%
!SweepList(ClickedOn%,1+o%)=y%
sweep_redraw
sweep_redraw
x%,y%,loop%,l2%,o%,displayside%,colour%
CursorOn%=
Display_StartDrawing
Display_Move(0,-MainYWidth%/2)
Display_Draw(0,MainYWidth%/2)
Display_Colour(7):colour%=7
displayside%=0
loop%=0
loop%<>SweepPos%
x%=SweepList(loop%,0)
y%=SweepList(loop%,1)
displayside%=1
Sweep_TwoSided%
x%=-x%
x%=SweepList(loop%,2)
y%=SweepList(loop%,3)
ClickedOn%<>-1
loop%=ClickedOn%
ClickedSide%=displayside%
Display_Colour(11)
loop%=0
Display_Move(x%,y%)
Display_Draw(x%,y%)
ClickedOn%<>-1
loop%=ClickedOn%+1
ClickedSide%=displayside%
Display_Colour(colour%)
loop%+=1
Display_Colour(colour%)
Sweep_TwoSided%
Display_Colour(2):colour%=2
displayside%
Sweep_TwoSided%
l2%=0
loop%=0
loop%<>SweepPos%
x%=SweepList(loop%,0+l2%*2)
Sweep_TwoSided%
x%=-x%
y%=SweepList(loop%,1+l2%*2)
Display_Node(x%,y%)
loop%+=1
Display_EndDrawing
o%=ClickedSide%*2
ClickedOn%<>-1
Display_Cursor2D(SweepList(ClickedOn%,0+o%),SweepList(ClickedOn%,1+o%))
sweep_go
Sweep_Exists%<>-1
Object_DeleteItem(CurrentObj%,Sweep_Exists%)
myitem%=-1
Sweep_TwoSided%
(Sweep_Faces%
Sweep_Faces%+=1
Sweep_TwoSided%
Object_MakeMatrix(CurrentObj%,myitem%,Sweep_Faces%,SweepPos%-1,10,0,0,0,0,0,0,1,1,1,1+o%)
(angle=Sweep_Rotation%/(Sweep_Faces%)
middle%=Sweep_Faces%/2
floop%=0
Sweep_Faces%
ang=angle*floop%
floop%>middle%
fat%=middle%-(floop%-middle%)
fat%=floop%
ploop%=0
SweepPos%-1
Sweep_TwoSided%
conv=(middle%-fat%)/middle%
<x%=SweepList(ploop%,0)*conv-SweepList(ploop%,2)*(1-conv)
<y%=SweepList(ploop%,1)*conv+SweepList(ploop%,3)*(1-conv)
x%=SweepList(ploop%,0)
y%=SweepList(ploop%,1)
xn%=x%*cos-z%*sin
yn%=y%+Sweep_Yshift%*floop%
zn%=x%*sin+z%*cos
Object_MatrixPoint(CurrentObj%,myitem%,floop%,ploop%,xn%,yn%,zn%,1)
Selected%=myitem%
Select_Type%=8
sweep_deletepoint(point%)
loop%=point%
SweepPos%-2
+SweepList(loop%,0)=SweepList(loop%+1,0)
+SweepList(loop%,1)=SweepList(loop%+1,1)
+SweepList(loop%,2)=SweepList(loop%+1,2)
+SweepList(loop%,3)=SweepList(loop%+1,3)
SweepPos%-=1
ClickedOn%=point%-1
sweep_redraw
sweep_circle
centx%,centy%,loop%,radius%,r%,ang
sweep_findcentre(centx%,centy%)
radius%=0
loop%=0
SweepPos%-1
((SweepList(loop%,0)-centx%)^2+(SweepList(loop%,1)-centy%)^2)
r%>radius%radius%=r%
ang=-180/(SweepPos%-1)
loop%=0
SweepPos%-1
6SweepList(loop%,0)=centx%+radius%*
(ang*loop%-90)
6SweepList(loop%,1)=centy%+radius%*
(ang*loop%-90)
9SweepList(loop%,2)=-(centx%+radius%*
(ang*loop%-90))
9SweepList(loop%,3)=-(centy%+radius%*
(ang*loop%-90))
sweep_redraw
sweep_findcentre(
loop%,x%,y%,minx%,miny%,maxx%,maxy%
minx%=10000:maxx%=-10000
miny%=10000:maxy%=-10000
loop%=0
SweepPos%-1
x%=SweepList(loop%,0)
y%=SweepList(loop%,1)
x%<minx%minx%=x%
x%>maxx%maxx%=x%
y%<miny%miny%=y%
y%>maxy%maxy%=y%
cx%=(maxx%-minx%)/2+minx%
cy%=(maxy%-miny%)/2+miny%
cx%=0
sweep_addpoint(side%)
loop%=0:ok%=
side%=side%*2
loop%<SweepPos%-2
&"minx%=SweepList(loop%,0+side%)
'"miny%=SweepList(loop%,1+side%)
($maxx%=SweepList(loop%+1,0+side%)
)$maxy%=SweepList(loop%+1,1+side%)
minx%>maxx%
minx%,maxx%
miny%>maxy%
miny%,maxy%
x%>minx%
x%<maxx%
y%>miny%
y%<maxy%
-#x1%=maxx%-minx%:y1%=maxy%-miny%
x2%=x%-minx%:y2%=y%-miny%
y1%=0
y2%>-16
y2%<16
(x2%-x1%)<16
minx2%=x1%*(y2%-16)/y1%-16
maxx2%=x1%*(y2%+16)/y1%+16
x2%>=minx2%
x2%<=maxx2%
loop%+=1
l2%=SweepPos%
loop%
;'SweepList(l2%,0)=SweepList(l2%-1,0)
<'SweepList(l2%,1)=SweepList(l2%-1,1)
='SweepList(l2%,2)=SweepList(l2%-1,2)
>'SweepList(l2%,3)=SweepList(l2%-1,3)
Display_SnapToClaimedGrid(x%,y%)
side%=0
SweepList(loop%,0)=x%
SweepList(loop%,2)=-x%
SweepList(loop%,0)=-x%
SweepList(loop%,2)=x%
SweepList(loop%,1)=y%
SweepList(loop%,3)=y%
ClickedOn%=loop%
SweepPos%+=1
sweep_existing
O<pos%=
Object_FindItem(CurrentObj%,Selected%)+ObjectItem%
Sweep_TwoSided%=
SweepPos%=pos%!48+1
ploop%=0
SweepPos%-1
Object_MatrixPoint(CurrentObj%,Selected%,0,ploop%,SweepList(ploop%,0),SweepList(ploop%,1),SweepList(ploop%,2),0)
sweep_redraw
sweep_copysides
SweepPos%-1
Z$SweepList(l%,2)=-SweepList(l%,0)
[#SweepList(l%,3)=SweepList(l%,1)