aboutsummaryrefslogtreecommitdiffstats
path: root/glcd/fastMath.c
diff options
context:
space:
mode:
authortrsaunders <trsaunders@gmail.com>2012-07-24 17:22:50 +0100
committertrsaunders <trsaunders@gmail.com>2012-07-24 17:22:50 +0100
commite4094ad4681e2d73c1a22c60a7dd16835f9b7287 (patch)
tree8db74abf04b378191b7d036011b09ed32bb58ebc /glcd/fastMath.c
parent4ba0eb23a7d41a0f2afee3fd64b9ed56684bf865 (diff)
parent8d7a588c5185558fdc85da867a37ecf09026bb3c (diff)
downloaduGFX-e4094ad4681e2d73c1a22c60a7dd16835f9b7287.tar.gz
uGFX-e4094ad4681e2d73c1a22c60a7dd16835f9b7287.tar.bz2
uGFX-e4094ad4681e2d73c1a22c60a7dd16835f9b7287.zip
get pixel return value implemented in struct
Diffstat (limited to 'glcd/fastMath.c')
-rw-r--r--glcd/fastMath.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/glcd/fastMath.c b/glcd/fastMath.c
index 26ae0d3f..1957b304 100644
--- a/glcd/fastMath.c
+++ b/glcd/fastMath.c
@@ -116,44 +116,39 @@ float sintable[91] = {
};
-float getSin(unsigned int degree)
-{
+float getSin(unsigned int degree) {
degree = degree % 360;
- if(degree <= 90)
- {
+
+ if(degree <= 90) {
return sintable[degree];
}
- else if(degree <= 180)
- {
+ else if(degree <= 180) {
return sintable[180-degree];
}
- else if(degree <= 270)
- {
+ else if(degree <= 270) {
return sintable[degree-180]*(-1.0);
}
- else
- {
+ else {
return sintable[360-degree]*(-1.0);
}
}
-double getCos(unsigned int degree)
-{
+double getCos(unsigned int degree) {
degree = degree % 360;
+
return getSin(degree+90);
}
/* signum function */
-char sgn(char x){
+char sgn(char x) {
return (x > 0) ? 1 : (x < 0) ? -1 : 0;
}
-unsigned char max(unsigned char a, unsigned char b)
-{
+unsigned char max(unsigned char a, unsigned char b) {
return (a<b) ? b : a;
}
-unsigned char min (unsigned char a, unsigned char b)
-{
+unsigned char min (unsigned char a, unsigned char b) {
return (a<b) ? a : b;
}
+