| |
|
|
p.specht
| the nachstehende Progrämmchen should whom Use with Pie, Arc and Chord-command something logischer make. the example in the Profan-Help berücksichtigt z.B. not The tipped perspective with Tortendiagrammen. in the nachstehenden Machwerk becomes very for worry worn, that the (z.B. Anteils-abhängigen) Winkel always the applied perspective (aka. "Kavalier-Riss") adjusted proceed. Angenehmer Nebeneffekt: The Tortenstück-pages walk now too with very wide, but only little high Diagrammen always to that Mauscursor there, what a manuelle input terrific relieved.
P.s.: that the thing yet demented plenty To wish over can, about Farb-, Füll- and Formänderungen, Beschriftungen u.v.a.m., is clear. But at least, a first lästige (Formel-)Hürde is now geschafft. for really good Tortendiagramme there good Include- and PCU-Files in this board!
Window Title "SIMPLER PIE-ARC-CHORD-TRAINER":Window Style 24:Window 0,0 - %maxx,%maxy
'(CL) CopyLeft 2014-11 by P.woodpecker, Wien. without jedwede Gewähr!
print "\n operating (Please no Hochstelltaste use!):"
print "\n 1. mouse on *left upper* corner the Darstellundrechtecks, 'M'-Button for 'MERKEN'"
print "\n 2. mouse on rights downstairs corner the Darstellundrechtecks, 'R'-Button for 'RECHTECK'"
print "\n it'll The middle the Tortenstücks abgezeigt, because these now feststeht."
print "\n 3. Winkellinie mouse To Mittelpunkt gives Startwinkel: 'V'-Button for 'OF'"
print "\n 4. Winkellinie mouse To Mittelpunkt gives Stop-winkel: 'B'-Button for 'BIS'"
print "\n Tortenstück becomes drawn."
print "\n 5. 'C' for 'CLS' = Clear Screen"
print "\n plenty joke at exercise!\n"
var xh&=width(%hwnd):var yh&=height(%hwnd)
declare LOX&,LOY&,LUX&,LUY&,SX&,SY&,EX&,EY&,StartAngle!,StopAngle!,Kippwinkel!
Repeat
waitinput
case %key=27:end
'print %key
if %key=109
print "M";
LOX&=%mousex:LOY&=%mousey
endif
if %key=114
print "R";
usepen 0,2,rgb(0,255,0)
LUX&=%mousex:LUY&=%mousey
rectangle LOX&,LOY& - LUX&,LUY&
usepen 0,5,rgb(255,0,0)
moveto (Lox&+lux&)\2,(Loy&+luy&)\2
lineto (Lox&+lux&)\2+1,(Loy&+luy&)\2
endif
if %key=118
print "V";
SX&=%mousex:SY&=%mousey
endif
if %key=98
print "B";
EX&=%mousex:EY&=%mousey
usebrush 0,rgb(0,0,255)
usepen 0,5,rgb(255,0,0)
Kippwinkel! = arctan4( LUy&-LOy&, LUx&-LOx& )
StartAngle! = arctan4( Sx&-(LUx&+LOx&)/2 , (LUy&+LOy&)/2-Sy& )
StopAngle! = arctan4( Ex&-(LUx&+LOx&)/2 , (LUy&+LOy&)/2-Ey& )
' counts for Pie, Arc and Chord:
PIE LOX&,LOY& - LUX&,LUY&;\
(LUx&+LOx&+(LUx&-LOx&)*Cos(-StartAngle!)*cos(Kippwinkel!) )/2,\
(LUy&+LOy&+(LUy&-LOy&)*Sin(-StartAngle!)*sin(Kippwinkel!))/2;\
(LUx&+LOx&+(LUx&-LOx&)*Cos(-StopAngle!)*cos(Kippwinkel!))/2,\
(LUy&+LOy&+(LUy&-LOy&)*Sin(-StopAngle!)*sin(Kippwinkel!))/2
endif
case %key=99:cls
until 0
proc ArcTan4 :parameters x!,y!
var pi!=3.1415926535897932:var w!=0'(CL)2014-01 P.woodpecker§gmx.at
if x!=0:if y!>0:w!=pi!*0.5:elseif y!<0:w!=pi!*1.5:else :w!=0:endif :return w!:elseif x!>0
if y!=0:w!=0:return w!:elseif y!>0:if x!>y!:w!=arctan(y!/x!):else :w!=pi!/2-arctan(x!/y!):endif
return w!:else :if x!<-y!:w!=pi!*1.5+arctan(x!/-y!):else :w!=2*pi!-arctan(-y!/x!):endif :return w!
endif :else :if y!>0:if x!>-y!:w!=pi!/2+arctan(-x!/y!):return w!:else :w!=pi!-arctan(y!/-x!)
return w!:endif :elseif y!<0:if x!<y!:w!=pi!+arctan(-y!/-x!):else :w!=pi!*1.5-arctan(-x!/-y!)
endif :return w!:else :w!=pi!:return w!:endif :endif :Print " ArcTan4 ERROR":waitinput:waitinput
endproc
|
|
|
| Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/16/21 ▲ |
|
|
|