PB 6.20 B3 RotateCoordinates not rotating

Post bugreports for the Windows version here
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

PB 6.20 B3 RotateCoordinates not rotating

Post 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
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Re: PB 6.20 B3 RotateCoordinates not rotating

Post 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
User avatar
Mijikai
Addict
Addict
Posts: 1520
Joined: Sun Sep 11, 2016 2:17 pm

Re: PB 6.20 B3 RotateCoordinates not rotating

Post 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
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Re: PB 6.20 B3 RotateCoordinates not rotating

Post 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.
User avatar
mk-soft
Always Here
Always Here
Posts: 6242
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB 6.20 B3 RotateCoordinates not rotating

Post by mk-soft »

Same result on macOS like linux, but not on windows
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Mijikai
Addict
Addict
Posts: 1520
Joined: Sun Sep 11, 2016 2:17 pm

Re: PB 6.20 B3 RotateCoordinates not rotating

Post by Mijikai »

Thanks for the clarification @Justin & @mk-soft.
Post Reply