using GFX_PI internally to avoid issues with M_PI
This commit is contained in:
parent
5a99092b79
commit
02e793e5db
4 changed files with 10 additions and 10 deletions
|
@ -82,14 +82,14 @@ int main(void) {
|
||||||
gwinGraphDrawAxis(gh);
|
gwinGraphDrawAxis(gh);
|
||||||
|
|
||||||
for(i = 0; i < gwinGetWidth(gh); i++)
|
for(i = 0; i < gwinGetWidth(gh); i++)
|
||||||
gwinGraphDrawPoint(gh, i-gwinGetWidth(gh)/2, 80*fsin(2*i/5)); //sin(2*0.2*M_PI*i/180));
|
gwinGraphDrawPoint(gh, i-gwinGetWidth(gh)/2, 80*fsin(2*i/5)); //sin(2*0.2*GFX_PI*i/180));
|
||||||
|
|
||||||
gwinGraphStartSet(gh);
|
gwinGraphStartSet(gh);
|
||||||
GraphStyle1.point.color = Green;
|
GraphStyle1.point.color = Green;
|
||||||
gwinGraphSetStyle(gh, &GraphStyle1);
|
gwinGraphSetStyle(gh, &GraphStyle1);
|
||||||
|
|
||||||
for(i = 0; i < gwinGetWidth(gh)*5; i++)
|
for(i = 0; i < gwinGetWidth(gh)*5; i++)
|
||||||
gwinGraphDrawPoint(gh, i/5-gwinGetWidth(gh)/2, 95*fsin(2*i/5)); //sin(2*0.2*M_PI*i/180));
|
gwinGraphDrawPoint(gh, i/5-gwinGetWidth(gh)/2, 95*fsin(2*i/5)); //sin(2*0.2*GFX_PI*i/180));
|
||||||
|
|
||||||
gwinGraphStartSet(gh);
|
gwinGraphStartSet(gh);
|
||||||
gwinGraphSetStyle(gh, &GraphStyle2);
|
gwinGraphSetStyle(gh, &GraphStyle2);
|
||||||
|
|
|
@ -1725,8 +1725,8 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c
|
||||||
sedge = round(radius * ((sbit & 0x99) ? fsin(start) : fcos(start)));
|
sedge = round(radius * ((sbit & 0x99) ? fsin(start) : fcos(start)));
|
||||||
eedge = round(radius * ((ebit & 0x99) ? fsin(end) : fcos(end)));
|
eedge = round(radius * ((ebit & 0x99) ? fsin(end) : fcos(end)));
|
||||||
#else
|
#else
|
||||||
sedge = round(radius * ((sbit & 0x99) ? sin(start*M_PI/180) : cos(start*M_PI/180)));
|
sedge = round(radius * ((sbit & 0x99) ? sin(start*GFX_PI/180) : cos(start*GFX_PI/180)));
|
||||||
eedge = round(radius * ((ebit & 0x99) ? sin(end*M_PI/180) : cos(end*M_PI/180)));
|
eedge = round(radius * ((ebit & 0x99) ? sin(end*GFX_PI/180) : cos(end*GFX_PI/180)));
|
||||||
#endif
|
#endif
|
||||||
if (sbit & 0xB4) sedge = -sedge;
|
if (sbit & 0xB4) sedge = -sedge;
|
||||||
if (ebit & 0xB4) eedge = -eedge;
|
if (ebit & 0xB4) eedge = -eedge;
|
||||||
|
@ -1852,8 +1852,8 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c
|
||||||
sxb = FP2FIXED(radius*fcos(start)); sy = -round(radius*fsin(start));
|
sxb = FP2FIXED(radius*fcos(start)); sy = -round(radius*fsin(start));
|
||||||
exb = FP2FIXED(radius*fcos(end)); ey = -round(radius*fsin(end));
|
exb = FP2FIXED(radius*fcos(end)); ey = -round(radius*fsin(end));
|
||||||
#else
|
#else
|
||||||
sxb = FP2FIXED(radius*cos(start*M_PI/180)); sy = -round(radius*sin(start*M_PI/180));
|
sxb = FP2FIXED(radius*cos(start*GFX_PI/180)); sy = -round(radius*sin(start*GFX_PI/180));
|
||||||
exb = FP2FIXED(radius*cos(end*M_PI/180)); ey = -round(radius*sin(end*M_PI/180));
|
exb = FP2FIXED(radius*cos(end*GFX_PI/180)); ey = -round(radius*sin(end*GFX_PI/180));
|
||||||
#endif
|
#endif
|
||||||
sxd = sy ? sxb/sy : sxb;
|
sxd = sy ? sxb/sy : sxb;
|
||||||
exd = ey ? exb/ey : exb;
|
exd = ey ? exb/ey : exb;
|
||||||
|
|
|
@ -75,14 +75,14 @@ typedef int32_t fixed;
|
||||||
/**
|
/**
|
||||||
* @brief The famous number pi
|
* @brief The famous number pi
|
||||||
*/
|
*/
|
||||||
#ifndef PI
|
#ifndef GFX_PI
|
||||||
#define PI 3.1415926535897932384626433832795028841971693993751
|
#define GFX_PI 3.1415926535897932384626433832795028841971693993751
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief pi as a fixed point
|
* @brief pi as a fixed point
|
||||||
*/
|
*/
|
||||||
#define FIXED_PI FP2FIXED(PI)
|
#define FIXED_PI FP2FIXED(GFX_PI)
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* External declarations. */
|
/* External declarations. */
|
||||||
|
|
|
@ -75,7 +75,7 @@ void gmiscMatrixFloat2DApplyRotation(MatrixFloat2D *dst, const MatrixFloat2D *sr
|
||||||
s = fsin(angle);
|
s = fsin(angle);
|
||||||
c = fcos(angle);
|
c = fcos(angle);
|
||||||
#else
|
#else
|
||||||
c = angle*M_PI/180;
|
c = angle*GFX_PI/180;
|
||||||
s = sin(c);
|
s = sin(c);
|
||||||
c = cos(c);
|
c = cos(c);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue