KiCad PCB EDA Suite
Loading...
Searching...
No Matches
trackball.cpp File Reference
#include <cmath>
#include <trackball.h>

Go to the source code of this file.

Macros

#define TRACKBALLSIZE   (0.8f)
 
#define RENORMCOUNT   97
 

Functions

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

Macro Definition Documentation

◆ RENORMCOUNT

#define RENORMCOUNT   97

Definition at line 247 of file trackball.cpp.

◆ TRACKBALLSIZE

#define TRACKBALLSIZE   (0.8f)

Definition at line 67 of file trackball.cpp.

Function Documentation

◆ add_quats()

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

Definition at line 249 of file trackball.cpp.

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

◆ axis_to_quat()

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

Definition at line 205 of file trackball.cpp.

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

Referenced by trackball().

◆ build_rotmatrix()

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

Definition at line 306 of file trackball.cpp.

Referenced by TRACK_BALL::Drag(), and TRACK_BALL::Interpolate().

◆ normalize_quat()

static void normalize_quat ( double  q[4])
static

Definition at line 291 of file trackball.cpp.

Referenced by add_quats().

◆ tb_project_to_sphere()

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

Definition at line 217 of file trackball.cpp.

Referenced by trackball().

◆ trackball()

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

◆ vadd()

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

Definition at line 136 of file trackball.cpp.

Referenced by add_quats().

◆ vcopy()

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

Definition at line 96 of file trackball.cpp.

References v1, and v2.

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

◆ vcross()

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

Definition at line 104 of file trackball.cpp.

References v1, v2, and vcopy().

Referenced by add_quats(), and trackball().

◆ vdot()

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

Definition at line 131 of file trackball.cpp.

References v1, and v2.

Referenced by add_quats().

◆ vlength()

double vlength ( const double *  v)

Definition at line 114 of file trackball.cpp.

Referenced by trackball(), and vnormal().

◆ vnormal()

void vnormal ( double *  v)

Definition at line 126 of file trackball.cpp.

References vlength(), and vscale().

Referenced by axis_to_quat().

◆ vscale()

void vscale ( double *  v,
double  div 
)

Definition at line 119 of file trackball.cpp.

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

◆ vset()

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

Definition at line 82 of file trackball.cpp.

Referenced by trackball().

◆ vsub()

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

Definition at line 89 of file trackball.cpp.

Referenced by trackball().

◆ vzero()

void vzero ( double *  v)

Definition at line 75 of file trackball.cpp.

Referenced by trackball().