[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[palito-dev] dashcircle
From: |
Michael Devey |
Subject: |
[palito-dev] dashcircle |
Date: |
Sun, 28 Sep 2003 00:34:49 +1000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030319 Debian/1.3-3 |
ok moving dashes and boundary conditions are hideous and I give up for
tonight. I'll crack a clean version of dashed line this week some time,
but to start getting patrols to look better here's dashcircle.
maybe I'll do semidashcircle as well but I feel it's too much effort for
nothing.
subnote for barrett - previously all my complaining about wrong
directions was infact using atan2(x,y) instead of atan2(y,x) (wrong
index in vectors...) grrrr. Also I was using a completely unnecessary
manipulation on the initial angle - I should have just got it's
adjustment from the manipulated radius (As I have now) moo!
void flush2d_dashcircle(float x, float y, float r, float moves, int num)
{
/*
flush lod?
3 lines (4 vertices) per small arc until lod.
*/
#define MAGICMYKE_pi 3.141592654
#define MAGICMYKE_dash_vertices 4
int vertices = MAGICMYKE_dash_vertices;
float v[2], v1[2] = { x, y }, v2[2] = { r, 0 };
float radius, startR, sweepR;
int *ip, i, j;
if(!dynbuf((void **) &ipoints, &isize,
(vertices*num)*sizeof(int)*2))
return;
ip = ipoints;
sweepR = MAGICMYKE_pi / (vertices-1) / num;
afim2_mult_vector2(v, sp, v1);
matrix2_mult_vector2(v1, sp, v2);
startR = atan2 (v1[1], v1[0]) + moves;
radius = sqrt(v1[0]*v1[0] + v1[1]*v1[1]);
for(j=0; j < num ; j++){
for(i = 0; i < vertices; i++, startR += sweepR){
*ip = (int) ( v[0] + radius * cos(startR) ); ip++;
*ip = (int) ( v[1] + radius * sin(startR) ); ip++;
}
flush_polyline( ip -(vertices*2) , vertices);
startR += sweepR*(vertices-2);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [palito-dev] dashcircle,
Michael Devey <=