- Input Device Support
- BrMatrix34RollingBall()

**BrMatrix34RollingBall()**

Declaration:

**void BrMatrix34RollingBall(br_matrix34* mat, int dx, int dy, int radius)**

Arguments:

**br_matrix34 * mat**

A pointer to the destination matrix.

**int dx,dy**

The amount the `top surface' has moved in each direction.

**int radius**

The radius of the imaginary ball.

Effects: This function calculates the tangent vector (

`dx`

,`dy`

) to the sphere of radius `radius`

. in 3D, and uses this to determine the axis of rotation normal to this tangent at the centre of the sphere, and the angle subtended by the tangent vector. From this, a transform matrix is created, describing the rotation.Remarks: The function is expected to be used with frequent samples of movements made with the 2D manipulator, i.e. a movement of 10cm in one go will produce a smaller rotation (no greater than 180

Note that using the 2D manipulator to describe small circles can rotate the 3D object about its vertical axis.

Example:

int mouse_x,mouse_y; br_matrix34 mat; ... BrMatrix34RollingBall(&mat,-mouse_x,mouse_y,500);See Also: The book

Generated with CERN WebMaker