Camera

Camera — A camera description for 3D views

Synopsis

                    MiaCamera;
MiaCamera *         mia_camera_copy                     (MiaCamera *dest,
                                                         const MiaCamera *orig);
MiaCamera *         mia_camera_dup                      (MiaCamera *orig);
gfloat              mia_camera_get_dist                 (const MiaCamera *self);
MiaVector3d *       mia_camera_get_location             (const MiaCamera *self);
MiaQuaternion *     mia_camera_get_rotation             (const MiaCamera *self);
gfloat              mia_camera_get_zoom                 (const MiaCamera *self);
MiaCamera *         mia_camera_new                      (MiaVector3d *loc,
                                                         MiaQuaternion *rot,
                                                         gfloat zoom);
void                mia_camera_set_dist                 (MiaCamera *self,
                                                         gfloat dist);
void                mia_camera_set_location             (MiaCamera *self,
                                                         MiaVector3d *loc);
void                mia_camera_set_rotation             (MiaCamera *self,
                                                         MiaQuaternion *rot);
void                mia_camera_set_zoom                 (MiaCamera *self,
                                                         gfloat zoom);
gboolean            mia_camera_test                     (void);
gboolean            mia_camera_xmlio_write              (xmlNodePtr root,
                                                         xmlNsPtr ns,
                                                         const gchar *tag,
                                                         const MiaCamera *c);

Description

MiaCamera descibes a point of view within a 3D volume, i.e. camera location, view direction, and zoom are stored within this class and manipulated by the corresponding functions.

Details

MiaCamera

typedef struct _MiaCamera MiaCamera;

This defines the camera used to view a 3D data set.


mia_camera_copy ()

MiaCamera *         mia_camera_copy                     (MiaCamera *dest,
                                                         const MiaCamera *orig);

Copy a MiaCamera to an already created instance,

dest :

destination object

orig :

original object to be copied

Returns :

the copy of the camera

mia_camera_dup ()

MiaCamera *         mia_camera_dup                      (MiaCamera *orig);

Create a newly created duplicate of a MiaCamera. The returned camera must be freed by calling g_object_unref()

orig :

camera to be copied

Returns :

the copy of the camera

mia_camera_get_dist ()

gfloat              mia_camera_get_dist                 (const MiaCamera *self);

Evaluate the distance of the camera from the center of the universe (0,0,0)

self :

the camera

Returns :

the distance

mia_camera_get_location ()

MiaVector3d *       mia_camera_get_location             (const MiaCamera *self);

get current location of the camera (note that the z value is equal to the distance)

self :

the camera

Returns :

location

mia_camera_get_rotation ()

MiaQuaternion *     mia_camera_get_rotation             (const MiaCamera *self);

get the current view directopn of the camera as a rotation described by a MiaQuaternion

self :

the camera

Returns :

Quaternion describing the camera rotation

mia_camera_get_zoom ()

gfloat              mia_camera_get_zoom                 (const MiaCamera *self);

Get the current zoom value of the camera

self :

the camera

Returns :

zoom

mia_camera_new ()

MiaCamera *         mia_camera_new                      (MiaVector3d *loc,
                                                         MiaQuaternion *rot,
                                                         gfloat zoom);

Create a camera defined by its position, heading, distance and zoom. The created object must be destroyed by calling g_object_unref()

For some reason I can not remember, the location z value is ignored and the distance value is given separately.

loc :

The camera location, z is ignored

rot :

the rotation angle

zoom :

camera zoom into the field of view

Returns :

a newly created quaternion

mia_camera_set_dist ()

void                mia_camera_set_dist                 (MiaCamera *self,
                                                         gfloat dist);

Sets the new distance to the center (0,0,0), can also be achieved by setting the full location

self :

the camera

dist :

new distance to the center of the universe

mia_camera_set_location ()

void                mia_camera_set_location             (MiaCamera *self,
                                                         MiaVector3d *loc);

Set the new location of the camera

self :

the camera

loc :

new location of the camera

mia_camera_set_rotation ()

void                mia_camera_set_rotation             (MiaCamera *self,
                                                         MiaQuaternion *rot);

sets the current view direction of the camera as a rotation described by a MiaQuaternion

self :

the camera

rot :

new rotation of the camera position around the center of the universe

mia_camera_set_zoom ()

void                mia_camera_set_zoom                 (MiaCamera *self,
                                                         gfloat zoom);

sets the new zoom of the camera (i.e. change field of view)

self :

the camera

zoom :

the new zoom value for the camera

mia_camera_test ()

gboolean            mia_camera_test                     (void);

Run some tests on the camera (not impmented)

Returns :

TRUE if tests were successful

mia_camera_xmlio_write ()

gboolean            mia_camera_xmlio_write              (xmlNodePtr root,
                                                         xmlNsPtr ns,
                                                         const gchar *tag,
                                                         const MiaCamera *c);

Write the MiaCamera instance to an XML node

root :

XML node to attach the camera description to

ns :

XML namespace

tag :

XML tag to use to create the XML node.

c :

the camera to store

Returns :

true if the camera was sucessfully written nor c==NULL