RotateCoordinates

Just starting out? Need help? Post your questions and find answers here.
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

RotateCoordinates

Post by User_Russian »

It is necessary that the numbers are next to the lines, but this does not happen. What am I doing wrong?

Code: Select all

If OpenWindow(0, 0, 0, 400, 400, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CanvasGadget(0, 0, 0, 400, 400)
  
  If StartVectorDrawing(CanvasVectorOutput(0))
    
    w = VectorOutputWidth()
    h = VectorOutputHeight()
    
    VectorFont(LoadFont(0, "Arial", 16))
    
    VectorSourceColor(RGBA(0, 0, 0, 255))
    
    RotateCoordinates(w/2, h/2, 40)
    For i=40 To 320 Step 40
      MovePathCursor(w/2, h-10)
      AddPathLine(w/2, h-20)
      
      SaveVectorState()
      MovePathCursor(w/2, h-40)
      RotateCoordinates(w/2, h/2, 360-i)
      DrawVectorText(Str(i/40-1))
      RestoreVectorState()
      
      StrokePath(1)
      RotateCoordinates(w/2, h/2, 40)
    Next
            
    StopVectorDrawing()
  EndIf
  
  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf
User avatar
Erlend
Enthusiast
Enthusiast
Posts: 102
Joined: Mon Apr 19, 2004 8:22 pm
Location: NORWAY

Re: RotateCoordinates

Post by Erlend »

I do not have PB available here/right now so I'm not sure, but are you not drawing line and numbers on the same "diameter" only
moved slightly in y direction?

I think you need to draw number and lines on two seperate diameters..

Just my two cents...

Regards
Erlend
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: RotateCoordinates

Post by #NULL »

Maybe like this?

Code: Select all

      SaveVectorState()
      s.s = Str(i/40-1)
      MovePathCursor(w/2, h-40)
      RotateCoordinates(w/2, h/2, 360-i)
      ;AddPathCircle(PathCursorX(), PathCursorY(), 2)
      MovePathCursor(-VectorTextWidth(s)/2.0, -VectorTextHeight(s)/2.0, #PB_Path_Relative)
      DrawVectorText(s)
      RestoreVectorState()
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: RotateCoordinates

Post by User_Russian »

Thank you, this is what was needed.
Post Reply