PB 6.01 AddPathSeegments does not handle exponents (VectorDrawing)

Post bugreports for the Windows version here
User avatar
macros
User
User
Posts: 80
Joined: Wed Mar 15, 2006 1:47 pm
Location: Munich

PB 6.01 AddPathSeegments does not handle exponents (VectorDrawing)

Post by macros »

The AddPathSegements() function does not handle numbers with exponents as shown in the following code.
This is especially problematic as PathSegments() tends to output a string with such numbers under Windows.

Solution:
Either modify PathSegments() to only output numbers without exponents and mention that no exponents (but rational numbers) can be used in the help
or allow AddPathSegments() to handle numbers with exponents.

Code: Select all

OpenWindow(1,0,0,200,200,"Drawtest",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
CanvasGadget(1,0,0,200,200)
StartVectorDrawing(CanvasVectorOutput(1))

;VectorSourceColor($ff00ff00)
AddPathCircle(10,10,10)
string$=PathSegments()
Debug string$ 
; Here we see numbers with exponents e.g.  1.90735e-006 under Windows,
; depending on radius. 
; Under Linux no numbers with exponents are in the string, (only less likely?)
StrokePath(3)

; Failure to draw on Windows, suceeds under Linux
MovePathCursor(100,100)
AddPathSegments(string$,#PB_Path_Relative) ; Fails to handle numbers with exponents.
StrokePath(3)

; Under Linux numbers with exponents are also not drawn, should be a half-circle.
MovePathCursor(100,150)
AddPathSegments("M 20 10 C 20 15.5228 15.5228 20 10 20 "+
                "C 4.47716 20 1.90735e-006 15.5229 -9.53674e-007 10 Z",#PB_Path_Relative)
StrokePath(3)

StopVectorDrawing()

Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow