- translations for comments in blender lib files

This commit is contained in:
2003-04-26 16:02:26 +00:00
parent 701ebe126a
commit 695c968825
7 changed files with 175 additions and 175 deletions

View File

@@ -1,5 +1,6 @@
/* formules voor blender
/* arithb.c
*
* simple math for blender code
*
* sort of cleaned up mar-01 nzc
*
@@ -229,8 +230,8 @@ int Mat4Invert(float inverse[][4], const float mat[][4])
#ifdef TEST_ACTIVE
void Mat4InvertSimp(float inverse[][4], const float mat[][4])
{
/* alleen HOEK bewarende Matrices */
/* gebaseerd op GG IV pag 205 */
/* only for Matrices that have a rotation */
/* based at GG IV pag 205 */
float scale;
scale= mat[0][0]*mat[0][0] + mat[1][0]*mat[1][0] + mat[2][0]*mat[2][0];
@@ -238,7 +239,7 @@ void Mat4InvertSimp(float inverse[][4], const float mat[][4])
scale= 1.0/scale;
/* transpose en scale */
/* transpose and scale */
inverse[0][0]= scale*mat[0][0];
inverse[1][0]= scale*mat[0][1];
inverse[2][0]= scale*mat[0][2];
@@ -382,7 +383,7 @@ void Mat4Adj(float out[][4], const float in[][4]) /* out = ADJ(in) */
out[3][3] = Det3x3( a1, a2, a3, b1, b2, b3, c1, c2, c3);
}
void Mat4InvGG(float out[][4], const float in[][4]) /* van Graphic Gems I, out= INV(in) */
void Mat4InvGG(float out[][4], const float in[][4]) /* from Graphic Gems I, out= INV(in) */
{
int i, j;
float det;
@@ -403,7 +404,7 @@ void Mat4InvGG(float out[][4], const float in[][4]) /* van Graphic Gems I, out=
for(j=0; j<4; j++)
out[i][j] = out[i][j] / det;
/* de laatste factor is niet altijd 1. Hierdoor moet eigenlijk nog gedeeld worden */
/* the last factor is not always 1. For that reason an extra division should be implemented? */
}
@@ -412,10 +413,10 @@ void Mat3Inv(float m1[][3], const float m2[][3])
short a,b;
float det;
/* eerst adjoint */
/* calc adjoint */
Mat3Adj(m1,m2);
/* dan det oude mat! */
/* then determinant old matrix! */
det= m2[0][0]* (m2[1][1]*m2[2][2] - m2[1][2]*m2[2][1])
-m2[1][0]* (m2[0][1]*m2[2][2] - m2[0][2]*m2[2][1])
+m2[2][0]* (m2[0][1]*m2[1][2] - m2[0][2]*m2[1][1]);
@@ -886,11 +887,11 @@ void Mat4MulFloat(float *m, float f)
{
int i;
for(i=0;i<12;i++) m[i]*=f; /* tot 12 tellen: zonder vector */
for(i=0;i<12;i++) m[i]*=f; /* count to 12: without vector component */
}
void Mat4MulFloat3(float *m, float f) /* alleen de scale component */
void Mat4MulFloat3(float *m, float f) /* only scale component */
{
int i,j;
@@ -1053,14 +1054,14 @@ void QuatToMat4(const float *q, float m[][4])
m[3][3]= 1.0f;
}
void Mat3ToQuat(const float wmat[][3], float *q) /* uit Sig.Proc.85 pag 253 */
void Mat3ToQuat(const float wmat[][3], float *q) /* from Sig.Proc.85 pag 253 */
{
double tr, s;
float mat[3][3];
/* voor de netheid: op kopie werken */
/* work on a copy */
Mat3CpyMat3(mat, wmat);
Mat3Ortho(mat); /* dit moet EN op eind NormalQuat */
Mat3Ortho(mat); /* this is needed AND a NormalQuat in the end */
tr= 0.25*(1.0+mat[0][0]+mat[1][1]+mat[2][2]);
@@ -1104,13 +1105,13 @@ void Mat3ToQuat_is_ok(const float wmat[][3], float *q)
{
float mat[3][3], matr[3][3], matn[3][3], q1[4], q2[4], hoek, si, co, nor[3];
/* voor de netheid: op kopie werken */
/* work on a copy */
Mat3CpyMat3(mat, wmat);
Mat3Ortho(mat);
/* roteer z-as matrix op z-as */
/* rotate z-axis of matrix to z-axis */
nor[0] = mat[2][1]; /* uitprodukt met (0,0,1) */
nor[0] = mat[2][1]; /* cross product with (0,0,1) */
nor[1] = -mat[2][0];
nor[2] = 0.0;
Normalise(nor);
@@ -1121,16 +1122,16 @@ void Mat3ToQuat_is_ok(const float wmat[][3], float *q)
co= (float)cos(hoek);
si= (float)sin(hoek);
q1[0]= co;
q1[1]= -nor[0]*si; /* hier negatief, waarom is een raadsel */
q1[1]= -nor[0]*si; /* negative here, but why? */
q1[2]= -nor[1]*si;
q1[3]= -nor[2]*si;
/* roteer x-as van mat terug volgens inverse q1 */
/* rotate back x-axis from mat, using inverse q1 */
QuatToMat3(q1, matr);
Mat3Inv(matn, matr);
Mat3MulVecfl(matn, mat[0]);
/* en zet de x-asssen gelijk */
/* and align x-axes */
hoek= (float)(0.5*atan2(mat[0][1], mat[0][0]));
co= (float)cos(hoek);
@@ -1180,7 +1181,7 @@ float *vectoquat(const float *vec, short axis, short upflag)
static float q1[4];
float q2[4], nor[3], *fp, mat[3][3], hoek, si, co, x2, y2, z2, len1;
/* eerst roteer naar as */
/* first rotate to axis */
if(axis>2) {
x2= vec[0] ; y2= vec[1] ; z2= vec[2];
axis-= 3;
@@ -1199,7 +1200,7 @@ float *vectoquat(const float *vec, short axis, short upflag)
* problem is a rotation of an Y axis to the negative Y-axis for example.
*/
if(axis==0) { /* x-as */
if(axis==0) { /* x-axis */
nor[0]= 0.0;
nor[1]= -z2;
nor[2]= y2;
@@ -1210,7 +1211,7 @@ float *vectoquat(const float *vec, short axis, short upflag)
co= x2;
}
else if(axis==1) { /* y-as */
else if(axis==1) { /* y-axis */
nor[0]= z2;
nor[1]= 0.0;
nor[2]= -x2;
@@ -1221,7 +1222,7 @@ float *vectoquat(const float *vec, short axis, short upflag)
co= y2;
}
else { /* z-as */
else { /* z-axis */
nor[0]= -y2;
nor[1]= x2;
nor[2]= 0.0;
@@ -1278,7 +1279,7 @@ void VecUpMat3old(const float *vec, float mat[][3], short axis)
float inp, up[3];
short cox = 0, coy = 0, coz = 0;
/* up varieeren heeft geen zin, is eigenlijk helemaal geen up!
/* using different up's is not useful, infact there is no real 'up'!
*/
up[0]= 0.0;
@@ -1325,8 +1326,7 @@ void VecUpMat3(float *vec, float mat[][3], short axis)
float inp;
short cox = 0, coy = 0, coz = 0;
/* up varieeren heeft geen zin, is eigenlijk helemaal geen up!
* zie VecUpMat3old
/* using different up's is not useful, infact there is no real 'up'!
*/
if(axis==0) {
@@ -1368,7 +1368,7 @@ void VecUpMat3(float *vec, float mat[][3], short axis)
}
/* **************** VIEW / PROJEKTIE ******************************** */
/* **************** VIEW / PROJECTION ******************************** */
void i_ortho(
@@ -1640,7 +1640,7 @@ int VecCompare(const float *v1, const float *v2, float limit)
return 0;
}
void CalcNormShort(const short *v1, const short *v2, const short *v3, float *n) /* is ook uitprodukt */
void CalcNormShort(const short *v1, const short *v2, const short *v3, float *n) /* is also cross product */
{
float n1[3],n2[3];
@@ -1738,9 +1738,10 @@ double Sqrt3d(double d)
if(d<0) return -exp(log(-d)/3);
else return exp(log(d)/3);
}
/* afstand v1 tot lijn v2-v3 */
float DistVL2Dfl(const float *v1,const float *v2,const float *v3) /* met formule van Hesse :GEEN LIJNSTUK! */
{
/* distance v1 to line v2-v3 */
/* using Hesse formula, NO LINE PIECE! */
float DistVL2Dfl(const float *v1,const float *v2,const float *v3) {
float a[2],deler;
a[0]= v2[1]-v3[1];
@@ -1752,7 +1753,8 @@ float DistVL2Dfl(const float *v1,const float *v2,const float *v3) /* met formu
}
float PdistVL2Dfl(const float *v1,const float *v2,const float *v3) /* PointDist: WEL LIJNSTUK */
/* distance v1 to line-piece v2-v3 */
float PdistVL2Dfl(const float *v1,const float *v2,const float *v3)
{
float labda, rc[2], pt[2], len;
@@ -2156,10 +2158,10 @@ void Mat4ToSize(const float mat[][4], float *size)
void triatoquat(const float *v1, const float *v2, const float *v3, float *quat)
{
/* denkbeeldige x-as, y-as driehoek wordt geroteerd */
/* imaginary x-axis, y-axis triangle is being rotated */
float vec[3], q1[4], q2[4], n[3], si, co, hoek, mat[3][3], imat[3][3];
/* eerst z-as op vlaknormaal */
/* move z-axis to face-normal */
CalcNormFloat(v1, v2, v3, vec);
n[0]= vec[1];
@@ -2177,13 +2179,13 @@ void triatoquat(const float *v1, const float *v2, const float *v3, float *quat)
q1[2]= n[1]*si;
q1[3]= 0.0f;
/* v1-v2 lijn terug roteren */
/* rotate back line v1-v2 */
QuatToMat3(q1, mat);
Mat3Inv(imat, mat);
VecSubf(vec, v2, v1);
Mat3MulVecfl(imat, vec);
/* welke hoek maakt deze lijn met x-as? */
/* what angle has this line with x-axis? */
vec[2]= 0.0;
Normalise(vec);
@@ -2310,8 +2312,9 @@ void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv)
*lv = v;
}
/* Bij afspraak is cpack een getal dat als 0xFFaa66 of zo kan worden uitgedrukt. Is dus gevoelig voor endian.
* Met deze define wordt het altijd goed afgebeeld
/* we define a 'cpack' here as a (3 byte color code) number that can be expressed like 0xFFAA66 or so.
for that reason it is sensitive for endianness... with this function it works correctly
*/
unsigned int hsv_to_cpack(float h, float s, float v)

View File

@@ -327,10 +327,10 @@ void MTC_Mat3Inv(float m1[][3], float m2[][3])
short a,b;
float det;
/* eerst adjoint */
/* first adjoint */
MTC_Mat3Adj(m1,m2);
/* dan det oude mat! */
/* then determinant old mat! */
det= m2[0][0]* (m2[1][1]*m2[2][2] - m2[1][2]*m2[2][1])
-m2[1][0]* (m2[0][1]*m2[2][2] - m2[0][2]*m2[2][1])
+m2[2][0]* (m2[0][1]*m2[1][2] - m2[0][2]*m2[1][1]);

View File

@@ -208,7 +208,7 @@ float BLI_turbulence1(float noisesize, float x, float y, float z, int nr)
/* ********************* VAN PERLIN HIMSELF: ******************** */
/* ********************* FROM PERLIN HIMSELF: ******************** */
static char p[512+2]= {
@@ -368,7 +368,7 @@ float turbulence_perlin(float *point, float lofreq, float hifreq)
/* *************** AANROEPEN ALS: *************** */
/* *************** CALL AS: *************** */
float BLI_hnoisep(float noisesize, float x, float y, float z)
{

View File

@@ -232,7 +232,7 @@ static int fakemax;
static float beztol = 100.0;
/* extern: uit de libfm */
/* extern: from libfm */
static char *my_subrs[MAXSUBRS];
static unsigned int my_sublen[MAXSUBRS];
@@ -550,7 +550,7 @@ static short STDvsISO [][2] = {
0304, 0224, /* tilde */
};
/* from objfont.c de rest zit in lfm_s !!*/
/* from objfont.c, rest is in lfm_s !!*/
/* START 5.2 */
@@ -1306,7 +1306,7 @@ static void append_poly_offset(short ofsx, short ofsy, short * data)
while(1) {
switch(chardata[nshorts++] = *data++) {
case PO_BGNLOOP:
nshorts --; /* voor de eerste keer */
nshorts --; /* for the first time */
break;
case PO_RETENDLOOP:
case PO_RET:
@@ -1831,7 +1831,7 @@ static int docommand(int cmd)
}
}
/* i.p.v. the sidebearing[c1] moet misschen thesidebearing gebruikt worden */
/* instead of the sidebearing[c1] maybe thesidebearing should be used */
dy1 = pop();
dx1 = pop() + sidebearing[c1] - sidebearing[c2];
@@ -1965,7 +1965,7 @@ static VFontData *objfnt_to_vfontdata(objfnt *fnt)
}
vfd= MEM_callocN(sizeof(*vfd), "VFontData");
scale = 10.0/(float)fnt->scale; /* na IRIX 6.2, schaal klopte niet meer */
scale = 10.0/(float)fnt->scale; /* after IRIX 6.2, scaling went wrong */
for (i = 0; i < MAX_VF_CHARS; i++) {
cd = getchardesc(fnt, i);
@@ -1975,7 +1975,7 @@ static VFontData *objfnt_to_vfontdata(objfnt *fnt)
_data = data = cd->data;
do{
/* eerst even tellen */
/* count first */
_data = data;
count = 0;
ready = stop = 0;
@@ -2011,7 +2011,7 @@ static VFontData *objfnt_to_vfontdata(objfnt *fnt)
if ((count>0) && last[0] == first[0] && last[1] == first[1]) meet = 1;
else meet = 0;
/* is er meer dan 1 uniek punt ?*/
/* is there more than 1 unique point ?*/
if (count - meet > 0) {
data = _data;
@@ -2026,7 +2026,7 @@ static VFontData *objfnt_to_vfontdata(objfnt *fnt)
nu->bezt = bezt;
stop = 0;
/* punten inlezen */
/* read points */
do {
switch(*data++){
case SP_MOVETO:
@@ -2073,10 +2073,10 @@ static VFontData *objfnt_to_vfontdata(objfnt *fnt)
} while (stop == 0);
if (meet) {
/* kopieer handles */
/* copy handles */
nu->bezt->vec[0][0] = bezt->vec[0][0];
nu->bezt->vec[0][1] = bezt->vec[0][1];
/* en vergeet laatste punt */
/* and forget last point */
nu->pntsu--;
}
else {
@@ -2091,7 +2091,7 @@ static VFontData *objfnt_to_vfontdata(objfnt *fnt)
bezt->h2= bez2->h1= HD_VECT;
}
/* verboden handle combinaties */
/* forbidden handle combinations */
a= nu->pntsu;
bezt= nu->bezt;
while(a--) {

View File

@@ -117,12 +117,12 @@ void *new_mem_element(int size);
void addfillvlak(EditVert *v1, EditVert *v2, EditVert *v3);
int boundinside(PolyFill *pf1, PolyFill *pf2);
int boundisect(PolyFill *pf2, PolyFill *pf1);
void mergepolysSimp(PolyFill *pf1, PolyFill *pf2) /* pf2 bij pf1 */;
void mergepolysSimp(PolyFill *pf1, PolyFill *pf2) /* pf2 added to pf1 */;
EditEdge *existfilledge(EditVert *v1, EditVert *v2);
short addedgetoscanvert(ScFillVert *sc, EditEdge *eed);
short testedgeside(float *v1, float *v2, float *v3);
short testedgeside2(float *v1, float *v2, float *v3);
short boundinsideEV(EditEdge *eed, EditVert *eve) /* is eve binnen boundbox eed */;
short boundinsideEV(EditEdge *eed, EditVert *eve) /* is eve within boundbox eed */;
void testvertexnearedge(void);
void scanfill(PolyFill *pf);
void fill_mesh(void);
@@ -140,7 +140,7 @@ ListBase fillvlakbase = {0,0};
short cox, coy;
/* **** FUNKTIES VOOR QSORT *************************** */
/* **** FUBCTIONS FOR QSORT *************************** */
int vergscdata(const void *a1, const void *a2)
@@ -174,13 +174,16 @@ struct mem_elements {
char *data;
};
/* simple optimization for allocating thousands of small memory blocks
only to be used within loops, and not by one function at a time
free in the end, with argument '-1'
*/
void *new_mem_element(int size)
{
/* Alleen als gedurende het werken duizenden elementen worden aangemaakt en
* nooit (tussendoor) vrijgegeven. Op eind is vrijgeven nodig (-1).
*/
int blocksize= 16384;
static int offs= 0; /* het huidige vrije adres */
static int offs= 0; /* the current free adress */
static struct mem_elements *cur= 0;
static ListBase lb= {0, 0};
void *adr;
@@ -260,7 +263,7 @@ EditEdge *BLI_addfilledge(EditVert *v1, EditVert *v2)
void addfillvlak(EditVert *v1, EditVert *v2, EditVert *v3)
{
/* maakt geen edges aan */
/* does not make edges */
EditVlak *evl;
evl= new_mem_element(sizeof(EditVlak));
@@ -282,8 +285,8 @@ void addfillvlak(EditVert *v1, EditVert *v2, EditVert *v3)
int boundinside(PolyFill *pf1, PolyFill *pf2)
{
/* is pf2 INSIDE pf1 ? met boundingbox */
/* eerst testen of poly's bestaan */
/* is pf2 INSIDE pf1 ? using bounding box */
/* test first if polys exist */
if(pf1->edges==0 || pf2->edges==0) return 0;
@@ -296,8 +299,8 @@ int boundinside(PolyFill *pf1, PolyFill *pf2)
int boundisect(PolyFill *pf2, PolyFill *pf1)
{
/* is pf2 aangeraakt door pf1 ? met boundingbox */
/* eerst testen of poly's bestaan */
/* has pf2 been touched (intersected) by pf1 ? with bounding box */
/* test first if polys exist */
if(pf1->edges==0 || pf2->edges==0) return 0;
@@ -307,7 +310,7 @@ int boundisect(PolyFill *pf2, PolyFill *pf1)
if(pf2->min[cox] > pf1->max[cox] ) return 0;
if(pf2->min[coy] > pf1->max[coy] ) return 0;
/* samenvoegen */
/* join */
if(pf2->max[cox]<pf1->max[cox]) pf2->max[cox]= pf1->max[cox];
if(pf2->max[coy]<pf1->max[coy]) pf2->max[coy]= pf1->max[coy];
@@ -321,13 +324,12 @@ int boundisect(PolyFill *pf2, PolyFill *pf1)
void mergepolysSimp(PolyFill *pf1, PolyFill *pf2) /* pf2 bij pf1 */
/* PolyFill *pf1,*pf2; */
void mergepolysSimp(PolyFill *pf1, PolyFill *pf2) /* add pf2 to pf1 */
{
EditVert *eve;
EditEdge *eed;
/* alle oude polynummers vervangen */
/* replace old poly numbers */
eve= fillvertbase.first;
while(eve) {
if(eve->xs== pf2->nr) eve->xs= pf1->nr;
@@ -348,7 +350,6 @@ void mergepolysSimp(PolyFill *pf1, PolyFill *pf2) /* pf2 bij pf1 */
EditEdge *existfilledge(EditVert *v1, EditVert *v2)
/* EditVert *v1,*v2; */
{
EditEdge *eed;
@@ -362,8 +363,8 @@ EditEdge *existfilledge(EditVert *v1, EditVert *v2)
}
short testedgeside(float *v1, float *v2, float *v3) /* is v3 rechts van v1-v2 ? Met uizondering: v3==v1 || v3==v2*/
/* float *v1,*v2,*v3; */
short testedgeside(float *v1, float *v2, float *v3)
/* is v3 to the right of v1-v2 ? With exception: v3==v1 || v3==v2 */
{
float inp;
@@ -378,8 +379,8 @@ short testedgeside(float *v1, float *v2, float *v3) /* is v3 rechts van v1-v2 ?
return 1;
}
short testedgeside2(float *v1, float *v2, float *v3) /* is v3 rechts van v1-v2 ? niet doorsnijden! */
/* float *v1,*v2,*v3; */
short testedgeside2(float *v1, float *v2, float *v3)
/* is v3 to the right of v1-v2 ? no intersection allowed! */
{
float inp;
@@ -391,10 +392,8 @@ short testedgeside2(float *v1, float *v2, float *v3) /* is v3 rechts van v1-v2 ?
}
short addedgetoscanvert(ScFillVert *sc, EditEdge *eed)
/* ScFillVert *sc; */
/* EditEdge *eed; */
{
/* zoek eerste edge die rechts van eed ligt en stop eed daarvoor */
/* find first edge to the right of eed, and insert eed before that */
EditEdge *ed;
float fac,fac1,x,y;
@@ -437,15 +436,13 @@ short addedgetoscanvert(ScFillVert *sc, EditEdge *eed)
ScFillVert *addedgetoscanlist(EditEdge *eed, int len)
/* EditEdge *eed; */
/* int len; */
{
/* voegt edge op juiste plek in ScFillVert list */
/* geeft sc terug als edge al bestaat */
/* inserts edge at correct location in ScFillVert list */
/* returns sc when edge already exists */
ScFillVert *sc,scsearch;
EditVert *eve;
/* welke vert is linksboven */
/* which vert is left-top? */
if(eed->v1->co[coy] == eed->v2->co[coy]) {
if(eed->v1->co[cox] > eed->v2->co[cox]) {
eve= eed->v1;
@@ -458,7 +455,7 @@ ScFillVert *addedgetoscanlist(EditEdge *eed, int len)
eed->v1= eed->v2;
eed->v2= eve;
}
/* zoek plek in lijst */
/* find location in list */
scsearch.v1= eed->v1;
sc= (ScFillVert *)bsearch(&scsearch,scdata,len,
sizeof(ScFillVert), vergscdata);
@@ -469,9 +466,8 @@ ScFillVert *addedgetoscanlist(EditEdge *eed, int len)
return 0;
}
short boundinsideEV(EditEdge *eed, EditVert *eve) /* is eve binnen boundbox eed */
/* EditEdge *eed; */
/* EditVert *eve; */
short boundinsideEV(EditEdge *eed, EditVert *eve)
/* is eve inside boundbox eed */
{
float minx,maxx,miny,maxy;
@@ -498,8 +494,8 @@ short boundinsideEV(EditEdge *eed, EditVert *eve) /* is eve binnen boundbox eed
void testvertexnearedge(void)
{
/* alleen de vertices met ->h==1 worden getest op
nabijheid van edge, zo ja invoegen */
/* only vertices with ->h==1 are being tested for
being close to an edge, if true insert */
EditVert *eve;
EditEdge *eed,*ed1;
@@ -510,7 +506,7 @@ void testvertexnearedge(void)
if(eve->h==1) {
vec3[0]= eve->co[cox];
vec3[1]= eve->co[coy];
/* de bewuste edge vinden waar eve aan zit */
/* find the edge which has vertex eve */
ed1= filledgebase.first;
while(ed1) {
if(ed1->v1==eve || ed1->v2==eve) break;
@@ -543,7 +539,7 @@ void testvertexnearedge(void)
if(boundinsideEV(eed,eve)) {
dist= DistVL2Dfl(vec1,vec2,vec3);
if(dist<COMPLIMIT) {
/* nieuwe edge */
/* new edge */
ed1= BLI_addfilledge(eed->v1, eve);
/* printf("fill: vertex near edge %x\n",eve); */
@@ -564,10 +560,8 @@ void testvertexnearedge(void)
}
void splitlist(ListBase *tempve, ListBase *temped, short nr)
/* ListBase *tempve,*temped; */
/* short nr; */
{
/* alles zit in de templist, alleen poly nr naar fillist schrijven */
/* everything is in templist, write only poly nr to fillist */
EditVert *eve,*nextve;
EditEdge *eed,*nexted;
@@ -601,7 +595,7 @@ void scanfill(PolyFill *pf)
EditVert *eve,*v1,*v2,*v3;
EditEdge *eed,*nexted,*ed1,*ed2,*ed3;
float miny = 0.0;
int a,b,verts, maxvlak, totvlak;
int a,b,verts, maxvlak, totvlak; /* vlak = face in dutch! */
short nr, test, twoconnected=0;
nr= pf->nr;
@@ -619,7 +613,7 @@ void scanfill(PolyFill *pf)
eed= eed->next;
} */
/* STAP 0: alle nul lange edges eruit */
/* STEP 0: remove zero sized edges */
eed= filledgebase.first;
while(eed) {
if(eed->v1->co[cox]==eed->v2->co[cox]) {
@@ -644,8 +638,8 @@ void scanfill(PolyFill *pf)
eed= eed->next;
}
/* STAP 1: maak ahv van FillVert en FillEdge lijsten een gesorteerde
ScFillVert lijst
/* STEP 1: make using FillVert and FillEdge lists a sorted
ScFillVert list
*/
sc= scdata= (ScFillVert *)MEM_callocN(pf->verts*sizeof(ScFillVert),"Scanfill1");
eve= fillvertbase.first;
@@ -654,7 +648,7 @@ void scanfill(PolyFill *pf)
if(eve->xs==nr) {
if(eve->f!= 255) {
verts++;
eve->f= 0; /* vlag later voor connectedges */
eve->f= 0; /* flag for connectedges later on */
sc->v1= eve;
sc++;
}
@@ -695,19 +689,19 @@ void scanfill(PolyFill *pf)
}*/
/* STAP 2: FILL LUS */
/* STEP 2: FILL LOOP */
if(pf->f==0) twoconnected= 1;
/* (tijdelijke) beveiliging: nooit veel meer vlakken dan vertices */
/* (temporal) security: never much more faces than vertices */
totvlak= 0;
maxvlak= 2*verts; /* 2*verts: cirkel in driehoek, beide gevuld */
maxvlak= 2*verts; /* 2*verts: based at a filled circle within a triangle */
sc= scdata;
for(a=0;a<verts;a++) {
/* printf("VERTEX %d %x\n",a,sc->v1); */
ed1= sc->first;
while(ed1) { /* connectflags zetten */
while(ed1) { /* set connectflags */
nexted= ed1->next;
if(ed1->v1->h==1 || ed1->v2->h==1) {
BLI_remlink((ListBase *)&(sc->first),ed1);
@@ -719,7 +713,7 @@ void scanfill(PolyFill *pf)
ed1= nexted;
}
while(sc->first) { /* zolang er edges zijn */
while(sc->first) { /* for as long there are edges */
ed1= sc->first;
ed2= ed1->next;
@@ -731,17 +725,17 @@ void scanfill(PolyFill *pf)
}
if(ed2==0) {
sc->first=sc->last= 0;
/* printf("maar 1 edge aan vert\n"); */
/* printf("just 1 edge to vert\n"); */
BLI_addtail(&filledgebase,ed1);
ed1->v2->f= 0;
ed1->v1->h--;
ed1->v2->h--;
} else {
/* test rest vertices */
/* test rest of vertices */
v1= ed1->v2;
v2= ed1->v1;
v3= ed2->v2;
/* hieronder komt voor bij serie overlappende edges */
/* this happens with a serial of overlapping edges */
if(v1==v2 || v2==v3) break;
/* printf("test verts %x %x %x\n",v1,v2,v3); */
miny = ( (v1->co[coy])<(v3->co[coy]) ? (v1->co[coy]) : (v3->co[coy]) );
@@ -756,7 +750,7 @@ void scanfill(PolyFill *pf)
if(testedgeside(v1->co,v2->co,sc1->v1->co))
if(testedgeside(v2->co,v3->co,sc1->v1->co))
if(testedgeside(v3->co,v1->co,sc1->v1->co)) {
/* punt in driehoek */
/* point in triangle */
test= 1;
break;
@@ -765,7 +759,7 @@ void scanfill(PolyFill *pf)
sc1++;
}
if(test) {
/* nieuwe edge maken en overnieuw beginnen */
/* make new edge, and start over */
/* printf("add new edge %x %x and start again\n",v2,sc1->v1); */
ed3= BLI_addfilledge(v2, sc1->v1);
@@ -777,8 +771,8 @@ void scanfill(PolyFill *pf)
ed3->v2->h++;
}
else {
/* nieuwe driehoek */
/* printf("add vlak %x %x %x\n",v1,v2,v3); */
/* new triangle */
/* printf("add face %x %x %x\n",v1,v2,v3); */
addfillvlak(v1, v2, v3);
totvlak++;
BLI_remlink((ListBase *)&(sc->first),ed1);
@@ -786,7 +780,7 @@ void scanfill(PolyFill *pf)
ed1->v2->f= 0;
ed1->v1->h--;
ed1->v2->h--;
/* ed2 mag ook weg als het een oude is */
/* ed2 can be removed when it's an old one */
if(ed2->f==0 && twoconnected) {
BLI_remlink((ListBase *)&(sc->first),ed2);
BLI_addtail(&filledgebase,ed2);
@@ -795,7 +789,7 @@ void scanfill(PolyFill *pf)
ed2->v2->h--;
}
/* nieuwe edge */
/* new edge */
ed3= BLI_addfilledge(v1, v3);
BLI_remlink(&filledgebase, ed3);
ed3->f= 2;
@@ -805,8 +799,8 @@ void scanfill(PolyFill *pf)
/* printf("add new edge %x %x\n",v1,v3); */
sc1= addedgetoscanlist(ed3, verts);
if(sc1) { /* ed3 bestaat al: verwijderen*/
/* printf("Edge bestaat al\n"); */
if(sc1) { /* ed3 already exists: remove */
/* printf("Edge exists\n"); */
ed3->v1->h--;
ed3->v2->h--;
@@ -826,7 +820,7 @@ void scanfill(PolyFill *pf)
}
}
/* test op loze edges */
/* test for loose edges */
ed1= sc->first;
while(ed1) {
nexted= ed1->next;
@@ -848,14 +842,14 @@ void scanfill(PolyFill *pf)
int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
int BLI_edgefill(int mode) /* THE MAIN FILL ROUTINE */
{
/*
- fill werkt met eigen lijsten, eerst aanmaken dus (geen vlakken)
- geef vertices in ->vn de oude pointer mee
- alleen xs en ys worden hier niet gebruikt: daar kan je iets in verstoppen
- edge flag ->f wordt 2 als het nieuwe edge betreft
- mode: & 1 is kruispunten testen, edges maken (NOG DOEN )
- fill works with its own lists, so create that first (no faces!)
- for vertices, put in ->vn the old pointer
- struct elements xs en ys are not used here: don't hide stuff in it
- edge flag ->f becomes 2 when it's a new edge
- mode: & 1 is check for crossings, then create edges (TO DO )
*/
ListBase tempve, temped;
EditVert *eve;
@@ -864,7 +858,7 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
float *minp, *maxp, *v1, *v2, norm[3], len;
short a,c,poly=0,ok=0,toggle=0;
/* variabelen resetten*/
/* reset variables */
eve= fillvertbase.first;
while(eve) {
eve->f= 0;
@@ -873,8 +867,8 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
eve= eve->next;
}
/* eerst de vertices testen op aanwezigheid in edges */
/* plus flaggen resetten */
/* first test vertices if they are in edges */
/* including resetting of flags */
eed= filledgebase.first;
while(eed) {
eed->f= eed->f1= eed->h= 0;
@@ -895,10 +889,10 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
if(ok==0) return 0;
/* NEW NEW! projektie bepalen: met beste normaal */
/* pak de eerste drie verschillende verts */
/* NEW NEW! define projection: with 'best' normal */
/* just use the first three different vertices */
/* DIT STUK IS NOG STEEDS TAMELIJK ZWAK! */
/* THIS PART STILL IS PRETTY WEAK! (ton) */
eve= fillvertbase.last;
len= 0.0;
@@ -918,7 +912,7 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
eve= eve->next;
}
if(len==0.0) return 0; /* geen fill mogelijk */
if(len==0.0) return 0; /* no fill possible */
norm[0]= fabs(norm[0]);
norm[1]= fabs(norm[1]);
@@ -934,13 +928,13 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
cox= 1; coy= 2;
}
/* STAP 1: AANTAL POLY'S TELLEN */
/* STEP 1: COUNT POLYS */
eve= fillvertbase.first;
while(eve) {
/* pak eerste vertex zonder polynummer */
/* get first vertex with no poly number */
if(eve->xs==0) {
poly++;
/* nu een soort select connected */
/* now a sortof select connected */
ok= 1;
eve->xs= poly;
@@ -975,9 +969,9 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
}
eve= eve->next;
}
/* printf("aantal poly's: %d\n",poly); */
/* printf("amount of poly's: %d\n",poly); */
/* STAP 2: LOSSE EDGES EN SLIERTEN VERWIJDEREN */
/* STEP 2: remove loose edges and strings of edges */
eed= filledgebase.first;
while(eed) {
if(eed->v1->h++ >250) break;
@@ -985,12 +979,12 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
eed= eed->next;
}
if(eed) {
/* anders kan hierna niet met zekerheid vertices worden gewist */
/* otherwise it's impossible to be sure you can clear vertices */
callLocalErrorCallBack("No vertices with 250 edges allowed!");
return 0;
}
/* doet alleen vertices met ->h==1 */
/* does it only for vertices with ->h==1 */
testvertexnearedge();
ok= 1;
@@ -1023,18 +1017,18 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
}
/* STAND VAN ZAKEN:
- eve->f :1= aanwezig in edges
- eve->xs :polynummer
- eve->h :aantal edges aan vertex
- eve->vn :bewaren! oorspronkelijke vertexnummer
/* CURRENT STATUS:
- eve->f :1= availalble in edges
- eve->xs :polynumber
- eve->h :amount of edges connected to vertex
- eve->vn :store! original vertex number
- eed->f :
- eed->f1 :polynummer
- eed->f1 :poly number
*/
/* STAP 3: POLYFILL STRUCT MAKEN */
/* STEP 3: MAKE POLYFILL STRUCT */
pflist= (PolyFill *)MEM_callocN(poly*sizeof(PolyFill),"edgefill");
pf= pflist;
for(a=1;a<=poly;a++) {
@@ -1064,15 +1058,15 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
eve= eve->next;
}
/* STAP 4: GATEN OF BOUNDS VINDEN EN SAMENVOEGEN
* ( bounds alleen om grote hoeveelheden een beetje in stukjes te verdelen,
* de edgefill heeft van zichzelf een adequate autogat!!!
* LET OP: WERKT ALLEEN ALS POLY'S GESORTEERD ZIJN!!! */
/* STEP 4: FIND HOLES OR BOUNDS, JOIN THEM
* ( bounds just to divide it in pieces for optimization,
* the edgefill itself has good auto-hole detection)
* WATCH IT: ONLY WORKS WITH SORTED POLYS!!! */
if(poly>1) {
short *polycache, *pc;
/* dus: eerst sorteren */
/* so, sort first */
qsort(pflist, poly, sizeof(PolyFill), vergpoly);
/*pf= pflist;
@@ -1087,14 +1081,14 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
for(a=0; a<poly; a++, pf++) {
for(c=a+1;c<poly;c++) {
/* als 'a' inside 'c': samenvoegen (ook bbox)
* Pas Op: 'a' kan ook inside andere poly zijn.
/* if 'a' inside 'c': join (bbox too)
* Careful: 'a' can also be inside another poly.
*/
if(boundisect(pf, pflist+c)) {
*pc= c;
pc++;
}
/* alleen voor opt! */
/* only for optimize! */
/* else if(pf->max[cox] < (pflist+c)->min[cox]) break; */
}
@@ -1107,13 +1101,13 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
}
pf= pflist;
/* printf("na merge\n");
/* printf("after merge\n");
for(a=1;a<=poly;a++) {
printf("poly:%d edges:%d verts:%d flag: %d\n",a,pf->edges,pf->verts,pf->f);
pf++;
} */
/* STAP 5: DRIEHOEKEN MAKEN */
/* STEP 5: MAKE TRIANGLES */
tempve.first= fillvertbase.first;
tempve.last= fillvertbase.last;
@@ -1135,12 +1129,12 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
/* evl= fillvlakbase.first;
while(evl) {
printf("nieuw vlak %x %x %x\n",evl->v1,evl->v2,evl->v3);
printf("new face %x %x %x\n",evl->v1,evl->v2,evl->v3);
evl= evl->next;
}*/
/* VRIJGEVEN */
/* FREE */
MEM_freeN(pflist);
return 1;

View File

@@ -34,7 +34,7 @@
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h> /* voorkomt dat je bij malloc type moet aangeven */
#include <stdlib.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -95,7 +95,6 @@ struct statfs {
#include <pwd.h>
#endif
/* MAART: #ifndef __FreeBSD__ */
#if !defined(__FreeBSD__) && !defined(__APPLE__)
#include <malloc.h>
#endif
@@ -144,7 +143,7 @@ char *BLI_getwdN(char *dir)
int BLI_compare(struct direntry *entry1, struct direntry *entry2)
{
/* type is gelijk aan stat.st_mode */
/* type is equal to stat.st_mode */
if (S_ISDIR(entry1->type)){
if (S_ISDIR(entry2->type)==0) return (-1);

View File

@@ -1,4 +1,8 @@
/**
/* util.c
*
* various string, file, list operations.
*
*
* $Id$
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
@@ -28,7 +32,7 @@
* Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
* Diverse string, file, list operations.
*
*/
#include <stdio.h>
@@ -104,7 +108,7 @@ int BLI_stringdec(char *string, char *kop, char *staart, unsigned short *numlen)
if (len == len2) {
if (len > 4) {
/* .jf0 en .jf1 voor jstreams afvangen */
/* handle .jf0 en .jf1 for jstreams */
if (strncasecmp(string + len - 4, ".jf", 3) == 0) len -= 4;
else if (strncasecmp(string + len - 4, ".tga", 4) == 0) len -= 4;
else if (strncasecmp(string + len - 4, ".jpg", 4) == 0) len -= 4;
@@ -180,7 +184,7 @@ void BLI_newname(char * name, int add)
pic = BLI_stringdec(name, head, tail, &digits);
/* gaan we van 100 -> 99 of van 10 naar 9 */
/* are we going from 100 -> 99 or from 10 -> 9 */
if (add < 0 && digits < 4 && digits > 0) {
int i, exp;
exp = 1;
@@ -258,17 +262,17 @@ void BLI_insertlink(ListBase *listbase, void *vprevlink, void *vnewlink)
{
struct Link *prevlink= vprevlink, *newlink= vnewlink;
/* newlink komt na prevlink */
/* newlink comes after prevlink */
if (newlink == 0) return;
if (listbase == 0) return;
if(listbase->first==0) { /* lege lijst */
if(listbase->first==0) { /* empty list */
listbase->first= newlink;
listbase->last= newlink;
return;
}
if (prevlink== 0) { /* inserten voor eerste element */
if (prevlink== 0) { /* insert before first element */
newlink->next= listbase->first;
newlink->prev= 0;
newlink->next->prev= newlink;
@@ -276,7 +280,7 @@ void BLI_insertlink(ListBase *listbase, void *vprevlink, void *vnewlink)
return;
}
if (listbase->last== prevlink) /* aan einde lijst */
if (listbase->last== prevlink) /* at end of list */
listbase->last = newlink;
newlink->next= prevlink->next;
@@ -289,17 +293,17 @@ void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink)
{
struct Link *nextlink= vnextlink, *newlink= vnewlink;
/* newlink komt voor nextlink */
/* newlink before nextlink */
if (newlink == 0) return;
if (listbase == 0) return;
if(listbase->first==0) { /* lege lijst */
if(listbase->first==0) { /* empty list */
listbase->first= newlink;
listbase->last= newlink;
return;
}
if (nextlink== 0) { /* inserten aan einde lijst */
if (nextlink== 0) { /* insert at end of list */
newlink->prev= listbase->last;
newlink->next= 0;
((struct Link *)listbase->last)->next= newlink;
@@ -307,7 +311,7 @@ void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink)
return;
}
if (listbase->first== nextlink) /* aan begin lijst */
if (listbase->first== nextlink) /* at beginning of list */
listbase->first = newlink;
newlink->next= nextlink;