Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Diagramview 3D auto rotate (Read 2154 times)
Hamdy Ghanem
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 110
Location: Egypt
Joined: Mar 11th, 2009
Diagramview 3D auto rotate
Aug 17th, 2011 at 2:06pm
Print Post  
I want to auto rotate the view viewing
I add a code to change CameraPosition in a timer but it did not work

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
       ' dgView3D.CameraRotation = New Point3D(dgView3D.CameraRotation.X, dgView3D.CameraRotation.Y + 5, dgView3D.CameraRotation.Z)
       With dgView3D.CameraPosition
           Dim angleInPie As Double = _CurrentAngle * (Math.PI / 180)
           Dim sinOfAngle As Double = Math.Sin(angleInPie)
           Dim cosOfAngle As Double = Math.Cos(angleInPie)

           Dim nextX As Single = .X * cosOfAngle - .Y * sinOfAngle
           Dim nextY As Single = .Y * sinOfAngle + .Y * cosOfAngle
           Dim nextZ As Single = .Z

           dgView3D.CameraPosition = New Point3D(nextX, nextY, nextZ)
           _CurrentAngle += 1
           If _CurrentAngle > 360 Then

               _CurrentAngle = 0
           End If
           dgView3D.ResetProjection()
       End With

    End Sub
  
Back to top
 
IP Logged
 
Hamdy Ghanem
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 110
Location: Egypt
Joined: Mar 11th, 2009
Re: Diagramview 3D auto rotate
Reply #1 - Aug 17th, 2011 at 2:14pm
Print Post  
another question plz: with ctrl key why it is not rotating in center I feel it is taking some angle
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagramview 3D auto rotate
Reply #2 - Aug 18th, 2011 at 4:59am
Print Post  
I can't make any sense of your X and Y assignments. If you need the camera to move in a circle around some point in a fixed Z plane, use this formula:

nextX = point.X + radius * Math.Cos(angle);
nextY = point.Y + radius * Math.Sin(angle);

Then you can call the PointCameraTo method to point the camera to the center point.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Hamdy Ghanem
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 110
Location: Egypt
Joined: Mar 11th, 2009
Re: Diagramview 3D auto rotate
Reply #3 - Aug 20th, 2011 at 8:29am
Print Post  
what is the radus ?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagramview 3D auto rotate
Reply #4 - Aug 22nd, 2011 at 5:55am
Print Post  
It should be the distance from the camera to the rotation center, assuming you want the camera to move around that point. If you need the camera to stay in the same location but just change its orientation, you should only increment the CameraRotation angles.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint