ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts  1.0
ESP8266ILI9341DisplayProject
Data Structures | Functions
cordic.h File Reference

Cordic Routines Handle angle outside of the first quadrant Added standalone test to verify CORDIC against math library Add Documentation and references. More...

#include "cordic2c_inc.h"

Go to the source code of this file.

Data Structures

struct  point
 Point definition. More...
 

Functions

MEMSPACE double deg2rad (double deg)
 Convert Degrees to Rads. More...
 
double angle_quad (double quads, int *quad)
 Compute quadrant of angle and the quadrant modulus Note: Integer part is quadrant. More...
 
void Circular (Cordic_T x, Cordic_T y, Cordic_T z)
 Main Cordic routine - used for basic trig and vector rotations. More...
 
MEMSPACE void cordic_quad (double angle, double *s, double *c)
 Compute Sin and Cos from angle in quads using Cordic. More...
 
MEMSPACE void cordic_deg (double deg, double *s, double *c)
 Compute Sin and Cos from angle in degrees using Cordic. More...
 
MEMSPACE void cordic_rad (double rad, double *s, double *c)
 Compute Sin and Cos from angle in Rads using Cordic. More...
 
MEMSPACE void scale_point (point *P, double scale)
 Scale x,y,z by scale factor. More...
 
MEMSPACE void shift_point (point *P, point *shift)
 Shift x,y,z by shift. More...
 
MEMSPACE void rotate (point *P, point *V)
 Rotate point P by View point. More...
 
MEMSPACE void PerspectiveProjection (point *P, double scale, int x, int y)
 

Detailed Description

Cordic Routines Handle angle outside of the first quadrant Added standalone test to verify CORDIC against math library Add Documentation and references.

See also
http://en.wikipedia.org/wiki/CORDIC
cordic.h, we use fixed point numbers, where 1.0=Cordic_One Note: 1.0 = 90 degrees
Copyright © 2015 Mike Gore, GPL License
You are free to use this code under the terms of GPL
please retain a copy of this notice in any code you use it in.

This is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file cordic.h.

Function Documentation

double angle_quad ( double  quads,
int *  quad 
)

Compute quadrant of angle and the quadrant modulus Note: Integer part is quadrant.

See also
cordic.h, we use fixed point numbers, where 1.0=Cordic_One Note: 1.0 = 90 degrees
Parameters
[in]quads1.0 = 90 degrees
[out]quadquadrant 0 = 0 .. 89.9999, 1 = 90 ... 179.999 ..., etc
Returns
fractional part of quads

Definition at line 71 of file cordic.c.

Referenced by cordic_quad().

void Circular ( Cordic_T  x,
Cordic_T  y,
Cordic_T  z 
)

Main Cordic routine - used for basic trig and vector rotations.

See also
http://en.wikipedia.org/wiki/CORDIC
Parameters
[in,out]xCordik_K, out: Cos of z
[in,out]y0, out: Sin of z
[in,out]zfixed point version of angle
Returns
void

Definition at line 103 of file cordic.c.

Referenced by cordic_quad(), and main().

MEMSPACE void cordic_deg ( double  deg,
double *  s,
double *  c 
)

Compute Sin and Cos from angle in degrees using Cordic.

See also
http://en.wikipedia.org/wiki/CORDIC
Parameters
[in]degangle in degrees
[in,out]*ssin
[in,out]*ccos
Returns
void

Definition at line 215 of file cordic.c.

Referenced by PerspectiveProjection(), and rotate().

MEMSPACE void cordic_quad ( double  angle,
double *  s,
double *  c 
)

Compute Sin and Cos from angle in quads using Cordic.

See also
http://en.wikipedia.org/wiki/CORDIC
Parameters
[in]angleangle in quads ( 1 quad = 90 degrees)
[out]*ssin
[out]*ccos
Returns
void

Definition at line 144 of file cordic.c.

Referenced by cordic_deg(), and cordic_rad().

MEMSPACE void cordic_rad ( double  rad,
double *  s,
double *  c 
)

Compute Sin and Cos from angle in Rads using Cordic.

See also
http://en.wikipedia.org/wiki/CORDIC
Parameters
[in]radangle in radians
[out]*ssin
[out]*ccos
Returns
void

Definition at line 228 of file cordic.c.

MEMSPACE double deg2rad ( double  deg)

Convert Degrees to Rads.

Parameters
[in]degdegrees
Returns
radians

Convert Degrees to Rads.

Parameters
[in]degdegrees
Returns
radians

Definition at line 57 of file cordic.c.

Referenced by main().

MEMSPACE void PerspectiveProjection ( point P,
double  scale,
int  x,
int  y 
)

Definition at line 310 of file cordic.c.

Referenced by wire_draw().

MEMSPACE void rotate ( point P,
point V 
)

Rotate point P by View point.

Parameters
[in]*Px,y,z point
[in]*VView point
Returns
void

Definition at line 265 of file cordic.c.

Referenced by wire_draw().

MEMSPACE void scale_point ( point P,
double  scale 
)

Scale x,y,z by scale factor.

Parameters
[in]*Px,y,z point
[in]scalescale factor
Returns
void

Definition at line 239 of file cordic.c.

MEMSPACE void shift_point ( point P,
point shift 
)

Shift x,y,z by shift.

Parameters
[in]*Px,y,z point
[in]shiftshift to apply to x,y,z
Returns
void

Definition at line 252 of file cordic.c.