Page 1 of 1

PB 6.20 B3 RotateCoordinates not rotating

Posted: Fri Jan 24, 2025 7:41 pm
by Justin
The line is not rotated here, W1064:

Code: Select all

If OpenWindow(0, 0, 0, 400, 200, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    CanvasGadget(0, 0, 0, 400, 200)
		       
    If StartVectorDrawing(CanvasVectorOutput(0))
      VectorSourceColor(RGBA(0, 255, 0, 255))

			TranslateCoordinates(0, 20)
			RotateCoordinates(40, 0, 20)
			AddPathLine(40, 0, 0)
			StrokePath(4)

      StopVectorDrawing()
    EndIf
    
    Repeat
      Event = WaitWindowEvent()
    Until Event = #PB_Event_CloseWindow
 EndIf

Re: PB 6.20 B3 RotateCoordinates not rotating

Posted: Sun Jan 26, 2025 5:27 pm
by Justin
Rotation is broken, if i undesrtand well this should rotate the line at its center point (x 40) but it doesn't. It seems is rotated around x 0.

Code: Select all

If OpenWindow(0, 0, 0, 400, 200, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    CanvasGadget(0, 0, 0, 400, 200)
		       
    If StartVectorDrawing(CanvasVectorOutput(0))
      VectorSourceColor(RGBA(200, 50, 100, 255))
			FillVectorOutput()
			
      VectorSourceColor(RGBA(0, 255, 0, 255))
			TranslateCoordinates(10, 10)
			RotateCoordinates(40, 0, 25)

			AddPathLine(80, 0, 0)

			StrokePath(4)

      StopVectorDrawing()
    EndIf
    
    Repeat
      Event = WaitWindowEvent()
    Until Event = #PB_Event_CloseWindow
 EndIf

Re: PB 6.20 B3 RotateCoordinates not rotating

Posted: Tue Jan 28, 2025 7:54 am
by Mijikai
Works fine here, tested on Windows 10 (x64):

Code: Select all

EnableExplicit

Procedure.i Main()
  Protected.i exit,angle,mx,my
  If OpenWindow(0,0,0,256,256,"Rotation-Test",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
    If CanvasGadget(0,0,0,WindowWidth(0),WindowHeight(0))
      Repeat
        Repeat
          Select WindowEvent()
            Case #PB_Event_CloseWindow
              exit = #True
            Case #PB_Event_None
              Break
          EndSelect
        ForEver
        If StartVectorDrawing(CanvasVectorOutput(0))
          VectorSourceColor(RGBA(0,0,0,255))
          FillVectorOutput()
          If WindowMouseX(0) <> -1
            mx = WindowMouseX(0)
            my = WindowMouseY(0)
          EndIf
          TranslateCoordinates(mx - 128,my - 128)
          RotateCoordinates(128,128,angle)
          VectorSourceColor(RGBA(100,200,100,255))
          AddPathCircle(128,128,4)
          MovePathCursor(64,64)
          AddPathLine(192,192)
          StrokePath(2)
          VectorSourceColor(RGBA(200,100,100,255))
          AddPathCircle(64,64,10)
          AddPathCircle(192,192,10)
          FillPath()
          StopVectorDrawing()
        EndIf
        angle + 1
        Delay(20)
      Until exit
    EndIf
    CloseWindow(0)  
  EndIf
  ProcedureReturn #Null
EndProcedure

End Main()
Fix for the other code:

Code: Select all

If OpenWindow(0, 0, 0, 400, 200, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CanvasGadget(0, 0, 0, 400, 200) 
  Repeat
    Event = WaitWindowEvent(10)
    If StartVectorDrawing(CanvasVectorOutput(0))
      VectorSourceColor(RGBA(200, 50, 100, 255))
      FillVectorOutput()
      VectorSourceColor(RGBA(0, 255, 0, 255))
      TranslateCoordinates(10, 10)
      RotateCoordinates(40,0, i)
      MovePathCursor(0,0)
      AddPathLine(80, 0, 0)
      StrokePath(4)
      StopVectorDrawing()
      i + 1
    EndIf  
  Until Event = #PB_Event_CloseWindow
EndIf

Re: PB 6.20 B3 RotateCoordinates not rotating

Posted: Tue Jan 28, 2025 10:04 am
by Justin
Hi, thanks for the workarounds.
But the two snippets i posted work as expected on linux but not on windows, so there is a bug that i think it should be addressed.

Re: PB 6.20 B3 RotateCoordinates not rotating

Posted: Tue Jan 28, 2025 7:39 pm
by mk-soft
Same result on macOS like linux, but not on windows

Re: PB 6.20 B3 RotateCoordinates not rotating

Posted: Tue Jan 28, 2025 7:48 pm
by Mijikai
Thanks for the clarification @Justin & @mk-soft.