Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
Public Sub VBCircle(x As Single, y As Single, radius As Single, color As Long, startAngle As Single, endAngle As Single, aspect As Single, FillColor As Long) If endAngle <=0 Or endAngle > 2*Pi Then endAngle=2*Pi Dim halfStep1 As Single, halfStep2 As Single ' Is needed. If I don't do it, it don't run ok. Don't know why. Dim my2DGraphics As Graphics2D my2DGraphics = getGraphics() Dim tmpColor As Color tmpColor = my2DGraphics.getColor Dim angleLen As Single If endAngle > startAngle Then angleLen = endAngle-startAngle Else angleLen = endAngle+2*Pi-startAngle End If ' As I sayd before, if I don't do it, the program runs not perfect: halfStep1 = startAngle/Pi*180 halfStep2 = angleLen/Pi*180 Call my2DGraphics.setColor(RGBToColor(FillColor)) If FillColor <> -1 Then If aspect > 1 Then Call my2DGraphics.fillArc(x-radius/aspect, y-radius, radius*2/aspect, radius*2, halfStep1, halfStep2) Else Call my2DGraphics.fillArc(x-radius, y-radius*aspect, radius*2, radius*2*aspect, halfStep1, halfStep2) End If End If If color=-1 Then color=ForeColor Call my2DGraphics.setColor(RGBToColor(color)) If aspect > 1 Then Call my2DGraphics.drawArc(x-radius/aspect, y-radius, radius*2/aspect, radius*2, halfStep1, halfStep2) Else Call my2DGraphics.drawArc(x-radius, y-radius*aspect, radius*2, radius*2*aspect, halfStep1, halfStep2) End If Call my2DGraphics.setColor(tmpColor) Call disposeGraphics(my2DGraphics) End Sub |
Jabaco Source |
|
1 |
Call my2DGraphics.drawArc(x-radius, y-radius*aspect, radius*2, radius*2*aspect, startAngle/Pi*180, angleLen/Pi*180)
|
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
Public Sub Command1_Click() Picture1.VBCircle(40, 40, 36, 1, 3, 2, 2, RGB(255,255,0)) Picture1.VBCircle(0,0,30,12,1,3,2, -1) Picture1.VBCircle(150,100,100,RGB(255,0,0),0,1/2*3.141,1, -1) Picture1.VBCircle(150,100,100,12,0,0,2, -1) Picture1.VBCircle(150,100,100,12,0,0,4, -1) Picture1.VBCircle(150,100,100,12,0,0,8, -1) Picture1.VBCircle(150,100,100,12,0,0,1/2, -1) Picture1.VBCircle(150,100,100,12,0,0,1/4, -1) Picture1.VBCircle(150,100,100,12,0,0,1/8, -1) 'Creating a "Gleichdick". (Its a german word, Don't know how it is called in english) 'Ein Gleichdick ist - egal wo man es misst - an allen Stellen gleich dick. Obwohl es kein Kreis ist. XPos = 300 YPos = 70 Breite = 300 Hoehe = sqr((Breite*Breite)-((Breite/2) * (Breite/2))) Picture1.ForeColor=RGB(180,180,180) Picture1.Line(XPos,YPos,XPos+Breite,YPos) Picture1.Line(XPos,YPos,XPos+Breite/2,YPos+Hoehe) Picture1.Line(XPos+Breite/2,YPos+Hoehe,XPos+Breite,YPos) Picture1.ForeColor=RGB(255,0,0) Picture1.VBCircle (XPos, YPos, Breite, -1, 300 / 180 * Pi, 360 / 180 * Pi, 1, -1) Picture1.VBCircle (XPos + Breite / 2, YPos + Hoehe, Breite, -1, 60 / 180 * Pi, 120 / 180 * Pi, 1, -1) Picture1.VBCircle (XPos + Breite, YPos, Breite, -1, 180 / 180 * Pi, 240 / 180 * Pi, 1, -1) End Sub |
Source code |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
Sub Command1_Click() Picture1.Circle (40 * 15, 40 * 15), 36 * 15, 1, 3, 2, 2 Picture1.Circle (0 * 15, 0 * 15), 30 * 15, 12, 1, 3, 2 Picture1.Circle (150 * 15, 100 * 15), 100 * 15, RGB(255, 0, 0), 0, 1 / 2 * 3.141, 1 Picture1.Circle (150 * 15, 100 * 15), 100 * 15, 12, 0, 0, 2 Picture1.Circle (150 * 15, 100 * 15), 100 * 15, 12, 0, 0, 4 Picture1.Circle (150 * 15, 100 * 15), 100 * 15, 12, 0, 0, 8 Picture1.Circle (150 * 15, 100 * 15), 100 * 15, 12, 0, 0, 1 / 2 Picture1.Circle (150 * 15, 100 * 15), 100 * 15, 12, 0, 0, 1 / 4 Picture1.Circle (150 * 15, 100 * 15), 100 * 15, 12, 0, 0, 1 / 8 'Creating a "Gleichdick". (Its a german word, Don't know how it is called in english) 'Ein Gleichdick ist - egal wo man es misst - an allen Stellen gleich dick. Obwohl es kein Kreis ist. Pi = 3.141593 XPos = 300 * 15 YPos = 70 * 15 Breite = 300 * 15 Hoehe = Sqr((Breite * Breite) - ((Breite / 2) * (Breite / 2))) Picture1.ForeColor = RGB(180, 180, 180) Picture1.Line (XPos, YPos)-(XPos + Breite, YPos) Picture1.Line (XPos, YPos)-(XPos + Breite / 2, YPos + Hoehe) Picture1.Line (XPos + Breite / 2, YPos + Hoehe)-(XPos + Breite, YPos) Picture1.ForeColor = RGB(255, 0, 0) Picture1.Circle (XPos, YPos), Breite, , 300 / 180 * Pi, 360 / 180 * Pi, 1 Picture1.Circle (XPos + Breite / 2, YPos + Hoehe), Breite, , 60 / 180 * Pi, 120 / 180 * Pi, 1 Picture1.Circle (XPos + Breite, YPos), Breite, , 180 / 180 * Pi, 240 / 180 * Pi, 1 End Sub |
Source code |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
SCREEN 12 LINE (0, 0)-(639, 479), 15, BF CIRCLE (40, 40), 36, 1, 3, 2, 2 CIRCLE (0, 0), 30, 12, 1, 3, 2 CIRCLE (150, 100), 100, 12, 0, 1 / 2 * 3.141, 1 CIRCLE (150, 100), 100, 0, , , 2 CIRCLE (150, 100), 100, 0, , , 4 CIRCLE (150, 100), 100, 0, , , 8 CIRCLE (150, 100), 100, 0, , , 1 / 2 CIRCLE (150, 100), 100, 0, , , 1 / 4 CIRCLE (150, 100), 100, 0, , , 1 / 8 'Creating a "Gleichdick". (Its a german word, Don't know how it is called in english) 'Ein Gleichdick ist - egal wo man es misst - an allen Stellen gleich dick. Obwohl es kein Kreis ist. Pi = 3.141593 XPos = 300 YPos = 70 Breite = 300 Hoehe = SQR((Breite * Breite) - ((Breite / 2) * (Breite / 2))) LINE (XPos, YPos)-(XPos + Breite, YPos), 7 LINE (XPos, YPos)-(XPos + Breite / 2, YPos + Hoehe), 7 LINE (XPos + Breite / 2, YPos + Hoehe)-(XPos + Breite, YPos), 7 CIRCLE (XPos, YPos), Breite, 12, 300 / 180 * Pi, 0 / 180 * Pi, 1 CIRCLE (XPos + Breite / 2, YPos + Hoehe), Breite, 12, 60 / 180 * Pi, 120 / 180 * Pi, 1 CIRCLE (XPos + Breite, YPos), Breite, 12, 180 / 180 * Pi, 240 / 180 * Pi, 1 |
This post has been edited 1 times, last edit by "theuserbl" (Aug 18th 2009, 5:56pm)
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
Dim angle As Double Public Sub Form_Load() angle=0 DrawReu(200,200,300,angle) End Sub Public Sub DrawReu (x As Single, y As Single, width As Single, rotation As Double) Picture1.VBCircle(x,y,3,0,0,0,1,-1) Hoehe = sqr((width*width)-((width/2) * (width/2))) 'DHoehe = 2*tan(Pi/6)*width/2 DHoehe = 2*Hoehe/3 Picture1.ForeColor=0 'Picture1.Line(x,y,x+cos(rotation)*DHoehe,y+sin(rotation)*DHoehe) 'Picture1.Line(x,y,x+cos(rotation+2*Pi/3)*DHoehe,y+sin(rotation+2*Pi/3)*DHoehe) 'Picture1.Line(x,y,x+cos(rotation+4*Pi/3)*DHoehe,y+sin(rotation+4*Pi/3)*DHoehe) Dim P11 As Single, P12 As Single Dim P21 As Single, P22 As Single Dim P31 As Single, P32 As Single P11 = 150 / 180 * Pi - rotation P12 = 210 / 180 * Pi - rotation P21 = 150 / 180 * Pi - rotation - 2 * Pi / 3 P22 = 210 / 180 * Pi - rotation - 2 * Pi / 3 P31 = 150 / 180 * Pi - rotation - 4 * Pi / 3 + 2 * Pi P32 = 210 / 180 * Pi - rotation - 4 * Pi / 3 + 2 * Pi If P11 < 0 Then P11 = P11 + 2 * Pi If P12 < 0 Then P12 = P12 + 2 * Pi If P21 < 0 Then P21 = P21 + 2 * Pi If P22 < 0 Then P22 = P22 + 2 * Pi If P31 < 0 Then P31 = P31 + 2 * Pi If P32 < 0 Then P32 = P32 + 2 * Pi Picture1.VBCircle(x+cos(rotation)*DHoehe,y+sin(rotation)*DHoehe,width,0,P11,P12,1,-1) Picture1.VBCircle(x+cos(rotation+2*Pi/3)*DHoehe,y+sin(rotation+2*Pi/3)*DHoehe,width,0,P21,P22,1,-1) Picture1.VBCircle(x+cos(rotation+4*Pi/3)*DHoehe,y+sin(rotation+4*Pi/3)*DHoehe,width,0,P31,P32,1,-1) End Sub Public Sub Command1_Click() Picture1.cls angle = angle + pi/16 If angle>2*pi Then angle=angle-2*pi DrawReu(200,200,300,angle) End Sub |
Administrator
Date of registration: Jul 16th 2008
Location: Erlangen, Germany
Occupation: Software Developer
Hobbies: Jabaco, game theory, text-mining
It's not Jabaco That's the drawArc definition:Quoted
Is it my VBCircle implementation or Jabaco or Suns Arc-implementation ?
Java source code |
|
1 |
public abstract void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) |
Jabaco Source |
|
1 2 3 4 5 |
If aspect > 1 Then Call my2DGraphics.drawArc(Round(x - radius / aspect), Round(y - radius), Round(radius * 2.0 / aspect), Round(radius * 2.0), Round(halfStep1), Round(halfStep2)) Else Call my2DGraphics.drawArc(Round(x - radius), Round(y - radius * aspect), Round(radius * 2.0), Round(radius * 2.0 * aspect), Round(halfStep1), Round(halfStep2)) End If |