Public Member Functions | Private Member Functions | Private Attributes

MeshLib::CArcball Class Reference

CArcball Interface. More...

#include <arcball.h>

Collaboration diagram for MeshLib::CArcball:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CArcball ()
 CArcball (int width, int height, int ox, int oy)
CQrot update (int nx, int ny)

Private Member Functions

void _plane2sphere (const CPoint2 &v, CPoint &r)

Private Attributes

CPoint m_position
double m_radius
CPoint2 m_center

Detailed Description

CArcball Interface.

Arcball interface is widely used for user interaction, because it is intuitive and efficient. Imagine there is a glass ball centered at the screen user can hold one point on the ball, and drag the ball to rotate it. Everything inisde the ball with be roated accordingly.

Definition at line 28 of file arcball.h.


Constructor & Destructor Documentation

MeshLib::CArcball::CArcball (  )  [inline]

CArcball default constructor

Definition at line 34 of file arcball.h.

{};

CArcball::CArcball ( int  width,
int  height,
int  ox,
int  oy 
)

CArcball constructor

Parameters:
width width of the window
height height of the window
ox original x position
oy original y position

Definition at line 16 of file arcball.cpp.

Here is the call graph for this function:


Member Function Documentation

void CArcball::_plane2sphere ( const CPoint2 v,
CPoint r 
) [private]

mapping a planar point v to the unit sphere point r

Parameters:
v input planar point
r output point on the unit sphere

Definition at line 29 of file arcball.cpp.

{

  CPoint2 f = p;
  f /= m_radius;

  double l = sqrt( f*f );

  if( l > 1.0 ){
      q=CPoint( f[0]/l, f[1]/l,0);
      return;
  }

  double fz = sqrt( 1 - l * l );

  q = CPoint( f[0],f[1],fz );
}

Here is the caller graph for this function:

CQrot CArcball::update ( int  nx,
int  ny 
)

Update the arcball

Parameters:
nx current x-position of mouse
ny current y-position of mouse
Returns:
quoternion of the roation from the old position to the new position

Definition at line 49 of file arcball.cpp.

{
    CPoint position;
    _plane2sphere( CPoint2(nx,ny), position );
    CPoint cp = m_position^position;
    CQrot r(m_position * position, cp[0],cp[1],cp[2]);
    m_position = position;

    return r;
}

Here is the call graph for this function:


Member Data Documentation

center of sphere on the plane

Definition at line 71 of file arcball.h.

current position on the unit sphere

Definition at line 63 of file arcball.h.

double MeshLib::CArcball::m_radius [private]

radius of the sphere

Definition at line 67 of file arcball.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Defines