Tachyon (current)  Current Main Branch
Macros | Functions
trackball.c File Reference
#include <math.h>
#include "trackball.h"

Go to the source code of this file.

Macros

#define TRACKBALLSIZE   (0.8)
 
#define RENORMCOUNT   97
 

Functions

static float tb_project_to_sphere (float, float, float)
 
static void normalize_quat (float [4])
 
void vzero (float *v)
 
void vset (float *v, float x, float y, float z)
 
void vsub (const float *src1, const float *src2, float *dst)
 
void vcopy (const float *v1, float *v2)
 
void vcross (const float *v1, const float *v2, float *cross)
 
float vlength (const float *v)
 
void vscale (float *v, float div)
 
void vnormal (float *v)
 
float vdot (const float *v1, const float *v2)
 
void vadd (const float *src1, const float *src2, float *dst)
 
void trackball (float q[4], float p1x, float p1y, float p2x, float p2y)
 
void axis_to_quat (float a[3], float phi, float q[4])
 
void add_quats (float q1[4], float q2[4], float dest[4])
 
void build_rotmatrix (float m[4][4], float q[4])
 

Macro Definition Documentation

◆ RENORMCOUNT

#define RENORMCOUNT   97

Definition at line 244 of file trackball.c.

Referenced by add_quats().

◆ TRACKBALLSIZE

#define TRACKBALLSIZE   (0.8)

Definition at line 62 of file trackball.c.

Referenced by trackball().

Function Documentation

◆ add_quats()

void add_quats ( float  q1[4],
float  q2[4],
float  dest[4] 
)

Definition at line 247 of file trackball.c.

References normalize_quat(), RENORMCOUNT, vadd(), vcopy(), vcross(), vdot(), and vscale().

Referenced by tachyon_spaceball_update().

◆ axis_to_quat()

void axis_to_quat ( float  a[3],
float  phi,
float  q[4] 
)

Definition at line 206 of file trackball.c.

References vcopy(), vnormal(), and vscale().

Referenced by tachyon_spaceball_update(), and trackball().

◆ build_rotmatrix()

void build_rotmatrix ( float  m[4][4],
float  q[4] 
)

Definition at line 302 of file trackball.c.

Referenced by tachyon_spaceball_update().

◆ normalize_quat()

static void normalize_quat ( float  q[4])
static

Definition at line 288 of file trackball.c.

Referenced by add_quats().

◆ tb_project_to_sphere()

static float tb_project_to_sphere ( float  r,
float  x,
float  y 
)
static

Definition at line 219 of file trackball.c.

Referenced by trackball().

◆ trackball()

void trackball ( float  q[4],
float  p1x,
float  p1y,
float  p2x,
float  p2y 
)

◆ vadd()

void vadd ( const float *  src1,
const float *  src2,
float *  dst 
)

Definition at line 140 of file trackball.c.

Referenced by add_quats().

◆ vcopy()

void vcopy ( const float *  v1,
float *  v2 
)

Definition at line 95 of file trackball.c.

Referenced by add_quats(), axis_to_quat(), and vcross().

◆ vcross()

void vcross ( const float *  v1,
const float *  v2,
float *  cross 
)

Definition at line 103 of file trackball.c.

References cross(), and vcopy().

Referenced by add_quats(), and trackball().

◆ vdot()

float vdot ( const float *  v1,
const float *  v2 
)

Definition at line 134 of file trackball.c.

Referenced by add_quats().

◆ vlength()

float vlength ( const float *  v)

Definition at line 114 of file trackball.c.

Referenced by trackball(), and vnormal().

◆ vnormal()

void vnormal ( float *  v)

Definition at line 128 of file trackball.c.

References vlength(), and vscale().

Referenced by axis_to_quat().

◆ vscale()

void vscale ( float *  v,
float  div 
)

Definition at line 120 of file trackball.c.

Referenced by add_quats(), axis_to_quat(), and vnormal().

◆ vset()

void vset ( float *  v,
float  x,
float  y,
float  z 
)

Definition at line 79 of file trackball.c.

Referenced by trackball().

◆ vsub()

void vsub ( const float *  src1,
const float *  src2,
float *  dst 
)

Definition at line 87 of file trackball.c.

Referenced by trackball().

◆ vzero()

void vzero ( float *  v)

Definition at line 71 of file trackball.c.

Referenced by trackball().