- translations for comments in blender lib files
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
|
/* arithb.c
|
||||||
/* formules voor blender
|
*
|
||||||
|
* simple math for blender code
|
||||||
*
|
*
|
||||||
* sort of cleaned up mar-01 nzc
|
* sort of cleaned up mar-01 nzc
|
||||||
*
|
*
|
||||||
@@ -229,8 +230,8 @@ int Mat4Invert(float inverse[][4], const float mat[][4])
|
|||||||
#ifdef TEST_ACTIVE
|
#ifdef TEST_ACTIVE
|
||||||
void Mat4InvertSimp(float inverse[][4], const float mat[][4])
|
void Mat4InvertSimp(float inverse[][4], const float mat[][4])
|
||||||
{
|
{
|
||||||
/* alleen HOEK bewarende Matrices */
|
/* only for Matrices that have a rotation */
|
||||||
/* gebaseerd op GG IV pag 205 */
|
/* based at GG IV pag 205 */
|
||||||
float scale;
|
float scale;
|
||||||
|
|
||||||
scale= mat[0][0]*mat[0][0] + mat[1][0]*mat[1][0] + mat[2][0]*mat[2][0];
|
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;
|
scale= 1.0/scale;
|
||||||
|
|
||||||
/* transpose en scale */
|
/* transpose and scale */
|
||||||
inverse[0][0]= scale*mat[0][0];
|
inverse[0][0]= scale*mat[0][0];
|
||||||
inverse[1][0]= scale*mat[0][1];
|
inverse[1][0]= scale*mat[0][1];
|
||||||
inverse[2][0]= scale*mat[0][2];
|
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);
|
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;
|
int i, j;
|
||||||
float det;
|
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++)
|
for(j=0; j<4; j++)
|
||||||
out[i][j] = out[i][j] / det;
|
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;
|
short a,b;
|
||||||
float det;
|
float det;
|
||||||
|
|
||||||
/* eerst adjoint */
|
/* calc adjoint */
|
||||||
Mat3Adj(m1,m2);
|
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])
|
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[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]);
|
+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;
|
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;
|
int i,j;
|
||||||
|
|
||||||
@@ -1053,14 +1054,14 @@ void QuatToMat4(const float *q, float m[][4])
|
|||||||
m[3][3]= 1.0f;
|
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;
|
double tr, s;
|
||||||
float mat[3][3];
|
float mat[3][3];
|
||||||
|
|
||||||
/* voor de netheid: op kopie werken */
|
/* work on a copy */
|
||||||
Mat3CpyMat3(mat, wmat);
|
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]);
|
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];
|
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);
|
Mat3CpyMat3(mat, wmat);
|
||||||
Mat3Ortho(mat);
|
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[1] = -mat[2][0];
|
||||||
nor[2] = 0.0;
|
nor[2] = 0.0;
|
||||||
Normalise(nor);
|
Normalise(nor);
|
||||||
@@ -1121,16 +1122,16 @@ void Mat3ToQuat_is_ok(const float wmat[][3], float *q)
|
|||||||
co= (float)cos(hoek);
|
co= (float)cos(hoek);
|
||||||
si= (float)sin(hoek);
|
si= (float)sin(hoek);
|
||||||
q1[0]= co;
|
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[2]= -nor[1]*si;
|
||||||
q1[3]= -nor[2]*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);
|
QuatToMat3(q1, matr);
|
||||||
Mat3Inv(matn, matr);
|
Mat3Inv(matn, matr);
|
||||||
Mat3MulVecfl(matn, mat[0]);
|
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]));
|
hoek= (float)(0.5*atan2(mat[0][1], mat[0][0]));
|
||||||
|
|
||||||
co= (float)cos(hoek);
|
co= (float)cos(hoek);
|
||||||
@@ -1180,7 +1181,7 @@ float *vectoquat(const float *vec, short axis, short upflag)
|
|||||||
static float q1[4];
|
static float q1[4];
|
||||||
float q2[4], nor[3], *fp, mat[3][3], hoek, si, co, x2, y2, z2, len1;
|
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) {
|
if(axis>2) {
|
||||||
x2= vec[0] ; y2= vec[1] ; z2= vec[2];
|
x2= vec[0] ; y2= vec[1] ; z2= vec[2];
|
||||||
axis-= 3;
|
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.
|
* 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[0]= 0.0;
|
||||||
nor[1]= -z2;
|
nor[1]= -z2;
|
||||||
nor[2]= y2;
|
nor[2]= y2;
|
||||||
@@ -1210,7 +1211,7 @@ float *vectoquat(const float *vec, short axis, short upflag)
|
|||||||
|
|
||||||
co= x2;
|
co= x2;
|
||||||
}
|
}
|
||||||
else if(axis==1) { /* y-as */
|
else if(axis==1) { /* y-axis */
|
||||||
nor[0]= z2;
|
nor[0]= z2;
|
||||||
nor[1]= 0.0;
|
nor[1]= 0.0;
|
||||||
nor[2]= -x2;
|
nor[2]= -x2;
|
||||||
@@ -1221,7 +1222,7 @@ float *vectoquat(const float *vec, short axis, short upflag)
|
|||||||
|
|
||||||
co= y2;
|
co= y2;
|
||||||
}
|
}
|
||||||
else { /* z-as */
|
else { /* z-axis */
|
||||||
nor[0]= -y2;
|
nor[0]= -y2;
|
||||||
nor[1]= x2;
|
nor[1]= x2;
|
||||||
nor[2]= 0.0;
|
nor[2]= 0.0;
|
||||||
@@ -1278,7 +1279,7 @@ void VecUpMat3old(const float *vec, float mat[][3], short axis)
|
|||||||
float inp, up[3];
|
float inp, up[3];
|
||||||
short cox = 0, coy = 0, coz = 0;
|
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;
|
up[0]= 0.0;
|
||||||
@@ -1324,10 +1325,9 @@ void VecUpMat3(float *vec, float mat[][3], short axis)
|
|||||||
{
|
{
|
||||||
float inp;
|
float inp;
|
||||||
short cox = 0, coy = 0, coz = 0;
|
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'!
|
||||||
* zie VecUpMat3old
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
if(axis==0) {
|
if(axis==0) {
|
||||||
cox= 0; coy= 1; coz= 2; /* Y up Z tr */
|
cox= 0; coy= 1; coz= 2; /* Y up Z tr */
|
||||||
@@ -1368,7 +1368,7 @@ void VecUpMat3(float *vec, float mat[][3], short axis)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* **************** VIEW / PROJEKTIE ******************************** */
|
/* **************** VIEW / PROJECTION ******************************** */
|
||||||
|
|
||||||
|
|
||||||
void i_ortho(
|
void i_ortho(
|
||||||
@@ -1640,7 +1640,7 @@ int VecCompare(const float *v1, const float *v2, float limit)
|
|||||||
return 0;
|
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];
|
float n1[3],n2[3];
|
||||||
|
|
||||||
@@ -1738,9 +1738,10 @@ double Sqrt3d(double d)
|
|||||||
if(d<0) return -exp(log(-d)/3);
|
if(d<0) return -exp(log(-d)/3);
|
||||||
else 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;
|
float a[2],deler;
|
||||||
|
|
||||||
a[0]= v2[1]-v3[1];
|
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;
|
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)
|
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];
|
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);
|
CalcNormFloat(v1, v2, v3, vec);
|
||||||
|
|
||||||
n[0]= vec[1];
|
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[2]= n[1]*si;
|
||||||
q1[3]= 0.0f;
|
q1[3]= 0.0f;
|
||||||
|
|
||||||
/* v1-v2 lijn terug roteren */
|
/* rotate back line v1-v2 */
|
||||||
QuatToMat3(q1, mat);
|
QuatToMat3(q1, mat);
|
||||||
Mat3Inv(imat, mat);
|
Mat3Inv(imat, mat);
|
||||||
VecSubf(vec, v2, v1);
|
VecSubf(vec, v2, v1);
|
||||||
Mat3MulVecfl(imat, vec);
|
Mat3MulVecfl(imat, vec);
|
||||||
|
|
||||||
/* welke hoek maakt deze lijn met x-as? */
|
/* what angle has this line with x-axis? */
|
||||||
vec[2]= 0.0;
|
vec[2]= 0.0;
|
||||||
Normalise(vec);
|
Normalise(vec);
|
||||||
|
|
||||||
@@ -2310,9 +2312,10 @@ void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv)
|
|||||||
*lv = v;
|
*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)
|
unsigned int hsv_to_cpack(float h, float s, float v)
|
||||||
{
|
{
|
||||||
|
@@ -327,10 +327,10 @@ void MTC_Mat3Inv(float m1[][3], float m2[][3])
|
|||||||
short a,b;
|
short a,b;
|
||||||
float det;
|
float det;
|
||||||
|
|
||||||
/* eerst adjoint */
|
/* first adjoint */
|
||||||
MTC_Mat3Adj(m1,m2);
|
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])
|
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[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]);
|
+m2[2][0]* (m2[0][1]*m2[1][2] - m2[0][2]*m2[1][1]);
|
||||||
|
@@ -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]= {
|
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)
|
float BLI_hnoisep(float noisesize, float x, float y, float z)
|
||||||
{
|
{
|
||||||
|
@@ -232,7 +232,7 @@ static int fakemax;
|
|||||||
|
|
||||||
static float beztol = 100.0;
|
static float beztol = 100.0;
|
||||||
|
|
||||||
/* extern: uit de libfm */
|
/* extern: from libfm */
|
||||||
|
|
||||||
static char *my_subrs[MAXSUBRS];
|
static char *my_subrs[MAXSUBRS];
|
||||||
static unsigned int my_sublen[MAXSUBRS];
|
static unsigned int my_sublen[MAXSUBRS];
|
||||||
@@ -550,7 +550,7 @@ static short STDvsISO [][2] = {
|
|||||||
0304, 0224, /* tilde */
|
0304, 0224, /* tilde */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* from objfont.c de rest zit in lfm_s !!*/
|
/* from objfont.c, rest is in lfm_s !!*/
|
||||||
|
|
||||||
/* START 5.2 */
|
/* START 5.2 */
|
||||||
|
|
||||||
@@ -1306,7 +1306,7 @@ static void append_poly_offset(short ofsx, short ofsy, short * data)
|
|||||||
while(1) {
|
while(1) {
|
||||||
switch(chardata[nshorts++] = *data++) {
|
switch(chardata[nshorts++] = *data++) {
|
||||||
case PO_BGNLOOP:
|
case PO_BGNLOOP:
|
||||||
nshorts --; /* voor de eerste keer */
|
nshorts --; /* for the first time */
|
||||||
break;
|
break;
|
||||||
case PO_RETENDLOOP:
|
case PO_RETENDLOOP:
|
||||||
case PO_RET:
|
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();
|
dy1 = pop();
|
||||||
dx1 = pop() + sidebearing[c1] - sidebearing[c2];
|
dx1 = pop() + sidebearing[c1] - sidebearing[c2];
|
||||||
@@ -1965,7 +1965,7 @@ static VFontData *objfnt_to_vfontdata(objfnt *fnt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
vfd= MEM_callocN(sizeof(*vfd), "VFontData");
|
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++) {
|
for (i = 0; i < MAX_VF_CHARS; i++) {
|
||||||
cd = getchardesc(fnt, i);
|
cd = getchardesc(fnt, i);
|
||||||
@@ -1975,7 +1975,7 @@ static VFontData *objfnt_to_vfontdata(objfnt *fnt)
|
|||||||
_data = data = cd->data;
|
_data = data = cd->data;
|
||||||
|
|
||||||
do{
|
do{
|
||||||
/* eerst even tellen */
|
/* count first */
|
||||||
_data = data;
|
_data = data;
|
||||||
count = 0;
|
count = 0;
|
||||||
ready = stop = 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;
|
if ((count>0) && last[0] == first[0] && last[1] == first[1]) meet = 1;
|
||||||
else meet = 0;
|
else meet = 0;
|
||||||
|
|
||||||
/* is er meer dan 1 uniek punt ?*/
|
/* is there more than 1 unique point ?*/
|
||||||
|
|
||||||
if (count - meet > 0) {
|
if (count - meet > 0) {
|
||||||
data = _data;
|
data = _data;
|
||||||
@@ -2026,7 +2026,7 @@ static VFontData *objfnt_to_vfontdata(objfnt *fnt)
|
|||||||
nu->bezt = bezt;
|
nu->bezt = bezt;
|
||||||
stop = 0;
|
stop = 0;
|
||||||
|
|
||||||
/* punten inlezen */
|
/* read points */
|
||||||
do {
|
do {
|
||||||
switch(*data++){
|
switch(*data++){
|
||||||
case SP_MOVETO:
|
case SP_MOVETO:
|
||||||
@@ -2073,10 +2073,10 @@ static VFontData *objfnt_to_vfontdata(objfnt *fnt)
|
|||||||
} while (stop == 0);
|
} while (stop == 0);
|
||||||
|
|
||||||
if (meet) {
|
if (meet) {
|
||||||
/* kopieer handles */
|
/* copy handles */
|
||||||
nu->bezt->vec[0][0] = bezt->vec[0][0];
|
nu->bezt->vec[0][0] = bezt->vec[0][0];
|
||||||
nu->bezt->vec[0][1] = bezt->vec[0][1];
|
nu->bezt->vec[0][1] = bezt->vec[0][1];
|
||||||
/* en vergeet laatste punt */
|
/* and forget last point */
|
||||||
nu->pntsu--;
|
nu->pntsu--;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -2091,7 +2091,7 @@ static VFontData *objfnt_to_vfontdata(objfnt *fnt)
|
|||||||
bezt->h2= bez2->h1= HD_VECT;
|
bezt->h2= bez2->h1= HD_VECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* verboden handle combinaties */
|
/* forbidden handle combinations */
|
||||||
a= nu->pntsu;
|
a= nu->pntsu;
|
||||||
bezt= nu->bezt;
|
bezt= nu->bezt;
|
||||||
while(a--) {
|
while(a--) {
|
||||||
|
@@ -117,12 +117,12 @@ void *new_mem_element(int size);
|
|||||||
void addfillvlak(EditVert *v1, EditVert *v2, EditVert *v3);
|
void addfillvlak(EditVert *v1, EditVert *v2, EditVert *v3);
|
||||||
int boundinside(PolyFill *pf1, PolyFill *pf2);
|
int boundinside(PolyFill *pf1, PolyFill *pf2);
|
||||||
int boundisect(PolyFill *pf2, PolyFill *pf1);
|
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);
|
EditEdge *existfilledge(EditVert *v1, EditVert *v2);
|
||||||
short addedgetoscanvert(ScFillVert *sc, EditEdge *eed);
|
short addedgetoscanvert(ScFillVert *sc, EditEdge *eed);
|
||||||
short testedgeside(float *v1, float *v2, float *v3);
|
short testedgeside(float *v1, float *v2, float *v3);
|
||||||
short testedgeside2(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 testvertexnearedge(void);
|
||||||
void scanfill(PolyFill *pf);
|
void scanfill(PolyFill *pf);
|
||||||
void fill_mesh(void);
|
void fill_mesh(void);
|
||||||
@@ -140,7 +140,7 @@ ListBase fillvlakbase = {0,0};
|
|||||||
|
|
||||||
short cox, coy;
|
short cox, coy;
|
||||||
|
|
||||||
/* **** FUNKTIES VOOR QSORT *************************** */
|
/* **** FUBCTIONS FOR QSORT *************************** */
|
||||||
|
|
||||||
|
|
||||||
int vergscdata(const void *a1, const void *a2)
|
int vergscdata(const void *a1, const void *a2)
|
||||||
@@ -174,13 +174,16 @@ struct mem_elements {
|
|||||||
char *data;
|
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)
|
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;
|
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 struct mem_elements *cur= 0;
|
||||||
static ListBase lb= {0, 0};
|
static ListBase lb= {0, 0};
|
||||||
void *adr;
|
void *adr;
|
||||||
@@ -260,7 +263,7 @@ EditEdge *BLI_addfilledge(EditVert *v1, EditVert *v2)
|
|||||||
|
|
||||||
void addfillvlak(EditVert *v1, EditVert *v2, EditVert *v3)
|
void addfillvlak(EditVert *v1, EditVert *v2, EditVert *v3)
|
||||||
{
|
{
|
||||||
/* maakt geen edges aan */
|
/* does not make edges */
|
||||||
EditVlak *evl;
|
EditVlak *evl;
|
||||||
|
|
||||||
evl= new_mem_element(sizeof(EditVlak));
|
evl= new_mem_element(sizeof(EditVlak));
|
||||||
@@ -282,8 +285,8 @@ void addfillvlak(EditVert *v1, EditVert *v2, EditVert *v3)
|
|||||||
|
|
||||||
int boundinside(PolyFill *pf1, PolyFill *pf2)
|
int boundinside(PolyFill *pf1, PolyFill *pf2)
|
||||||
{
|
{
|
||||||
/* is pf2 INSIDE pf1 ? met boundingbox */
|
/* is pf2 INSIDE pf1 ? using bounding box */
|
||||||
/* eerst testen of poly's bestaan */
|
/* test first if polys exist */
|
||||||
|
|
||||||
if(pf1->edges==0 || pf2->edges==0) return 0;
|
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)
|
int boundisect(PolyFill *pf2, PolyFill *pf1)
|
||||||
{
|
{
|
||||||
/* is pf2 aangeraakt door pf1 ? met boundingbox */
|
/* has pf2 been touched (intersected) by pf1 ? with bounding box */
|
||||||
/* eerst testen of poly's bestaan */
|
/* test first if polys exist */
|
||||||
|
|
||||||
if(pf1->edges==0 || pf2->edges==0) return 0;
|
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[cox] > pf1->max[cox] ) return 0;
|
||||||
if(pf2->min[coy] > pf1->max[coy] ) 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[cox]<pf1->max[cox]) pf2->max[cox]= pf1->max[cox];
|
||||||
if(pf2->max[coy]<pf1->max[coy]) pf2->max[coy]= pf1->max[coy];
|
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 */
|
void mergepolysSimp(PolyFill *pf1, PolyFill *pf2) /* add pf2 to pf1 */
|
||||||
/* PolyFill *pf1,*pf2; */
|
|
||||||
{
|
{
|
||||||
EditVert *eve;
|
EditVert *eve;
|
||||||
EditEdge *eed;
|
EditEdge *eed;
|
||||||
|
|
||||||
/* alle oude polynummers vervangen */
|
/* replace old poly numbers */
|
||||||
eve= fillvertbase.first;
|
eve= fillvertbase.first;
|
||||||
while(eve) {
|
while(eve) {
|
||||||
if(eve->xs== pf2->nr) eve->xs= pf1->nr;
|
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)
|
EditEdge *existfilledge(EditVert *v1, EditVert *v2)
|
||||||
/* EditVert *v1,*v2; */
|
|
||||||
{
|
{
|
||||||
EditEdge *eed;
|
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*/
|
short testedgeside(float *v1, float *v2, float *v3)
|
||||||
/* float *v1,*v2,*v3; */
|
/* is v3 to the right of v1-v2 ? With exception: v3==v1 || v3==v2 */
|
||||||
{
|
{
|
||||||
float inp;
|
float inp;
|
||||||
|
|
||||||
@@ -378,8 +379,8 @@ short testedgeside(float *v1, float *v2, float *v3) /* is v3 rechts van v1-v2 ?
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
short testedgeside2(float *v1, float *v2, float *v3) /* is v3 rechts van v1-v2 ? niet doorsnijden! */
|
short testedgeside2(float *v1, float *v2, float *v3)
|
||||||
/* float *v1,*v2,*v3; */
|
/* is v3 to the right of v1-v2 ? no intersection allowed! */
|
||||||
{
|
{
|
||||||
float inp;
|
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)
|
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;
|
EditEdge *ed;
|
||||||
float fac,fac1,x,y;
|
float fac,fac1,x,y;
|
||||||
|
|
||||||
@@ -437,15 +436,13 @@ short addedgetoscanvert(ScFillVert *sc, EditEdge *eed)
|
|||||||
|
|
||||||
|
|
||||||
ScFillVert *addedgetoscanlist(EditEdge *eed, int len)
|
ScFillVert *addedgetoscanlist(EditEdge *eed, int len)
|
||||||
/* EditEdge *eed; */
|
|
||||||
/* int len; */
|
|
||||||
{
|
{
|
||||||
/* voegt edge op juiste plek in ScFillVert list */
|
/* inserts edge at correct location in ScFillVert list */
|
||||||
/* geeft sc terug als edge al bestaat */
|
/* returns sc when edge already exists */
|
||||||
ScFillVert *sc,scsearch;
|
ScFillVert *sc,scsearch;
|
||||||
EditVert *eve;
|
EditVert *eve;
|
||||||
|
|
||||||
/* welke vert is linksboven */
|
/* which vert is left-top? */
|
||||||
if(eed->v1->co[coy] == eed->v2->co[coy]) {
|
if(eed->v1->co[coy] == eed->v2->co[coy]) {
|
||||||
if(eed->v1->co[cox] > eed->v2->co[cox]) {
|
if(eed->v1->co[cox] > eed->v2->co[cox]) {
|
||||||
eve= eed->v1;
|
eve= eed->v1;
|
||||||
@@ -458,7 +455,7 @@ ScFillVert *addedgetoscanlist(EditEdge *eed, int len)
|
|||||||
eed->v1= eed->v2;
|
eed->v1= eed->v2;
|
||||||
eed->v2= eve;
|
eed->v2= eve;
|
||||||
}
|
}
|
||||||
/* zoek plek in lijst */
|
/* find location in list */
|
||||||
scsearch.v1= eed->v1;
|
scsearch.v1= eed->v1;
|
||||||
sc= (ScFillVert *)bsearch(&scsearch,scdata,len,
|
sc= (ScFillVert *)bsearch(&scsearch,scdata,len,
|
||||||
sizeof(ScFillVert), vergscdata);
|
sizeof(ScFillVert), vergscdata);
|
||||||
@@ -469,9 +466,8 @@ ScFillVert *addedgetoscanlist(EditEdge *eed, int len)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
short boundinsideEV(EditEdge *eed, EditVert *eve) /* is eve binnen boundbox eed */
|
short boundinsideEV(EditEdge *eed, EditVert *eve)
|
||||||
/* EditEdge *eed; */
|
/* is eve inside boundbox eed */
|
||||||
/* EditVert *eve; */
|
|
||||||
{
|
{
|
||||||
float minx,maxx,miny,maxy;
|
float minx,maxx,miny,maxy;
|
||||||
|
|
||||||
@@ -498,8 +494,8 @@ short boundinsideEV(EditEdge *eed, EditVert *eve) /* is eve binnen boundbox eed
|
|||||||
|
|
||||||
void testvertexnearedge(void)
|
void testvertexnearedge(void)
|
||||||
{
|
{
|
||||||
/* alleen de vertices met ->h==1 worden getest op
|
/* only vertices with ->h==1 are being tested for
|
||||||
nabijheid van edge, zo ja invoegen */
|
being close to an edge, if true insert */
|
||||||
|
|
||||||
EditVert *eve;
|
EditVert *eve;
|
||||||
EditEdge *eed,*ed1;
|
EditEdge *eed,*ed1;
|
||||||
@@ -510,7 +506,7 @@ void testvertexnearedge(void)
|
|||||||
if(eve->h==1) {
|
if(eve->h==1) {
|
||||||
vec3[0]= eve->co[cox];
|
vec3[0]= eve->co[cox];
|
||||||
vec3[1]= eve->co[coy];
|
vec3[1]= eve->co[coy];
|
||||||
/* de bewuste edge vinden waar eve aan zit */
|
/* find the edge which has vertex eve */
|
||||||
ed1= filledgebase.first;
|
ed1= filledgebase.first;
|
||||||
while(ed1) {
|
while(ed1) {
|
||||||
if(ed1->v1==eve || ed1->v2==eve) break;
|
if(ed1->v1==eve || ed1->v2==eve) break;
|
||||||
@@ -543,7 +539,7 @@ void testvertexnearedge(void)
|
|||||||
if(boundinsideEV(eed,eve)) {
|
if(boundinsideEV(eed,eve)) {
|
||||||
dist= DistVL2Dfl(vec1,vec2,vec3);
|
dist= DistVL2Dfl(vec1,vec2,vec3);
|
||||||
if(dist<COMPLIMIT) {
|
if(dist<COMPLIMIT) {
|
||||||
/* nieuwe edge */
|
/* new edge */
|
||||||
ed1= BLI_addfilledge(eed->v1, eve);
|
ed1= BLI_addfilledge(eed->v1, eve);
|
||||||
|
|
||||||
/* printf("fill: vertex near edge %x\n",eve); */
|
/* printf("fill: vertex near edge %x\n",eve); */
|
||||||
@@ -564,10 +560,8 @@ void testvertexnearedge(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void splitlist(ListBase *tempve, ListBase *temped, short nr)
|
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;
|
EditVert *eve,*nextve;
|
||||||
EditEdge *eed,*nexted;
|
EditEdge *eed,*nexted;
|
||||||
|
|
||||||
@@ -601,7 +595,7 @@ void scanfill(PolyFill *pf)
|
|||||||
EditVert *eve,*v1,*v2,*v3;
|
EditVert *eve,*v1,*v2,*v3;
|
||||||
EditEdge *eed,*nexted,*ed1,*ed2,*ed3;
|
EditEdge *eed,*nexted,*ed1,*ed2,*ed3;
|
||||||
float miny = 0.0;
|
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;
|
short nr, test, twoconnected=0;
|
||||||
|
|
||||||
nr= pf->nr;
|
nr= pf->nr;
|
||||||
@@ -619,7 +613,7 @@ void scanfill(PolyFill *pf)
|
|||||||
eed= eed->next;
|
eed= eed->next;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
/* STAP 0: alle nul lange edges eruit */
|
/* STEP 0: remove zero sized edges */
|
||||||
eed= filledgebase.first;
|
eed= filledgebase.first;
|
||||||
while(eed) {
|
while(eed) {
|
||||||
if(eed->v1->co[cox]==eed->v2->co[cox]) {
|
if(eed->v1->co[cox]==eed->v2->co[cox]) {
|
||||||
@@ -644,8 +638,8 @@ void scanfill(PolyFill *pf)
|
|||||||
eed= eed->next;
|
eed= eed->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* STAP 1: maak ahv van FillVert en FillEdge lijsten een gesorteerde
|
/* STEP 1: make using FillVert and FillEdge lists a sorted
|
||||||
ScFillVert lijst
|
ScFillVert list
|
||||||
*/
|
*/
|
||||||
sc= scdata= (ScFillVert *)MEM_callocN(pf->verts*sizeof(ScFillVert),"Scanfill1");
|
sc= scdata= (ScFillVert *)MEM_callocN(pf->verts*sizeof(ScFillVert),"Scanfill1");
|
||||||
eve= fillvertbase.first;
|
eve= fillvertbase.first;
|
||||||
@@ -654,7 +648,7 @@ void scanfill(PolyFill *pf)
|
|||||||
if(eve->xs==nr) {
|
if(eve->xs==nr) {
|
||||||
if(eve->f!= 255) {
|
if(eve->f!= 255) {
|
||||||
verts++;
|
verts++;
|
||||||
eve->f= 0; /* vlag later voor connectedges */
|
eve->f= 0; /* flag for connectedges later on */
|
||||||
sc->v1= eve;
|
sc->v1= eve;
|
||||||
sc++;
|
sc++;
|
||||||
}
|
}
|
||||||
@@ -695,19 +689,19 @@ void scanfill(PolyFill *pf)
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
/* STAP 2: FILL LUS */
|
/* STEP 2: FILL LOOP */
|
||||||
|
|
||||||
if(pf->f==0) twoconnected= 1;
|
if(pf->f==0) twoconnected= 1;
|
||||||
|
|
||||||
/* (tijdelijke) beveiliging: nooit veel meer vlakken dan vertices */
|
/* (temporal) security: never much more faces than vertices */
|
||||||
totvlak= 0;
|
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;
|
sc= scdata;
|
||||||
for(a=0;a<verts;a++) {
|
for(a=0;a<verts;a++) {
|
||||||
/* printf("VERTEX %d %x\n",a,sc->v1); */
|
/* printf("VERTEX %d %x\n",a,sc->v1); */
|
||||||
ed1= sc->first;
|
ed1= sc->first;
|
||||||
while(ed1) { /* connectflags zetten */
|
while(ed1) { /* set connectflags */
|
||||||
nexted= ed1->next;
|
nexted= ed1->next;
|
||||||
if(ed1->v1->h==1 || ed1->v2->h==1) {
|
if(ed1->v1->h==1 || ed1->v2->h==1) {
|
||||||
BLI_remlink((ListBase *)&(sc->first),ed1);
|
BLI_remlink((ListBase *)&(sc->first),ed1);
|
||||||
@@ -719,7 +713,7 @@ void scanfill(PolyFill *pf)
|
|||||||
|
|
||||||
ed1= nexted;
|
ed1= nexted;
|
||||||
}
|
}
|
||||||
while(sc->first) { /* zolang er edges zijn */
|
while(sc->first) { /* for as long there are edges */
|
||||||
ed1= sc->first;
|
ed1= sc->first;
|
||||||
ed2= ed1->next;
|
ed2= ed1->next;
|
||||||
|
|
||||||
@@ -731,21 +725,21 @@ void scanfill(PolyFill *pf)
|
|||||||
}
|
}
|
||||||
if(ed2==0) {
|
if(ed2==0) {
|
||||||
sc->first=sc->last= 0;
|
sc->first=sc->last= 0;
|
||||||
/* printf("maar 1 edge aan vert\n"); */
|
/* printf("just 1 edge to vert\n"); */
|
||||||
BLI_addtail(&filledgebase,ed1);
|
BLI_addtail(&filledgebase,ed1);
|
||||||
ed1->v2->f= 0;
|
ed1->v2->f= 0;
|
||||||
ed1->v1->h--;
|
ed1->v1->h--;
|
||||||
ed1->v2->h--;
|
ed1->v2->h--;
|
||||||
} else {
|
} else {
|
||||||
/* test rest vertices */
|
/* test rest of vertices */
|
||||||
v1= ed1->v2;
|
v1= ed1->v2;
|
||||||
v2= ed1->v1;
|
v2= ed1->v1;
|
||||||
v3= ed2->v2;
|
v3= ed2->v2;
|
||||||
/* hieronder komt voor bij serie overlappende edges */
|
/* this happens with a serial of overlapping edges */
|
||||||
if(v1==v2 || v2==v3) break;
|
if(v1==v2 || v2==v3) break;
|
||||||
/* printf("test verts %x %x %x\n",v1,v2,v3); */
|
/* printf("test verts %x %x %x\n",v1,v2,v3); */
|
||||||
miny = ( (v1->co[coy])<(v3->co[coy]) ? (v1->co[coy]) : (v3->co[coy]) );
|
miny = ( (v1->co[coy])<(v3->co[coy]) ? (v1->co[coy]) : (v3->co[coy]) );
|
||||||
/* miny= MIN2(v1->co[coy],v3->co[coy]); */
|
/* miny= MIN2(v1->co[coy],v3->co[coy]); */
|
||||||
sc1= sc+1;
|
sc1= sc+1;
|
||||||
test= 0;
|
test= 0;
|
||||||
|
|
||||||
@@ -756,7 +750,7 @@ void scanfill(PolyFill *pf)
|
|||||||
if(testedgeside(v1->co,v2->co,sc1->v1->co))
|
if(testedgeside(v1->co,v2->co,sc1->v1->co))
|
||||||
if(testedgeside(v2->co,v3->co,sc1->v1->co))
|
if(testedgeside(v2->co,v3->co,sc1->v1->co))
|
||||||
if(testedgeside(v3->co,v1->co,sc1->v1->co)) {
|
if(testedgeside(v3->co,v1->co,sc1->v1->co)) {
|
||||||
/* punt in driehoek */
|
/* point in triangle */
|
||||||
|
|
||||||
test= 1;
|
test= 1;
|
||||||
break;
|
break;
|
||||||
@@ -765,7 +759,7 @@ void scanfill(PolyFill *pf)
|
|||||||
sc1++;
|
sc1++;
|
||||||
}
|
}
|
||||||
if(test) {
|
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); */
|
/* printf("add new edge %x %x and start again\n",v2,sc1->v1); */
|
||||||
|
|
||||||
ed3= BLI_addfilledge(v2, sc1->v1);
|
ed3= BLI_addfilledge(v2, sc1->v1);
|
||||||
@@ -777,8 +771,8 @@ void scanfill(PolyFill *pf)
|
|||||||
ed3->v2->h++;
|
ed3->v2->h++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* nieuwe driehoek */
|
/* new triangle */
|
||||||
/* printf("add vlak %x %x %x\n",v1,v2,v3); */
|
/* printf("add face %x %x %x\n",v1,v2,v3); */
|
||||||
addfillvlak(v1, v2, v3);
|
addfillvlak(v1, v2, v3);
|
||||||
totvlak++;
|
totvlak++;
|
||||||
BLI_remlink((ListBase *)&(sc->first),ed1);
|
BLI_remlink((ListBase *)&(sc->first),ed1);
|
||||||
@@ -786,7 +780,7 @@ void scanfill(PolyFill *pf)
|
|||||||
ed1->v2->f= 0;
|
ed1->v2->f= 0;
|
||||||
ed1->v1->h--;
|
ed1->v1->h--;
|
||||||
ed1->v2->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) {
|
if(ed2->f==0 && twoconnected) {
|
||||||
BLI_remlink((ListBase *)&(sc->first),ed2);
|
BLI_remlink((ListBase *)&(sc->first),ed2);
|
||||||
BLI_addtail(&filledgebase,ed2);
|
BLI_addtail(&filledgebase,ed2);
|
||||||
@@ -795,7 +789,7 @@ void scanfill(PolyFill *pf)
|
|||||||
ed2->v2->h--;
|
ed2->v2->h--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nieuwe edge */
|
/* new edge */
|
||||||
ed3= BLI_addfilledge(v1, v3);
|
ed3= BLI_addfilledge(v1, v3);
|
||||||
BLI_remlink(&filledgebase, ed3);
|
BLI_remlink(&filledgebase, ed3);
|
||||||
ed3->f= 2;
|
ed3->f= 2;
|
||||||
@@ -805,8 +799,8 @@ void scanfill(PolyFill *pf)
|
|||||||
/* printf("add new edge %x %x\n",v1,v3); */
|
/* printf("add new edge %x %x\n",v1,v3); */
|
||||||
sc1= addedgetoscanlist(ed3, verts);
|
sc1= addedgetoscanlist(ed3, verts);
|
||||||
|
|
||||||
if(sc1) { /* ed3 bestaat al: verwijderen*/
|
if(sc1) { /* ed3 already exists: remove */
|
||||||
/* printf("Edge bestaat al\n"); */
|
/* printf("Edge exists\n"); */
|
||||||
ed3->v1->h--;
|
ed3->v1->h--;
|
||||||
ed3->v2->h--;
|
ed3->v2->h--;
|
||||||
|
|
||||||
@@ -826,7 +820,7 @@ void scanfill(PolyFill *pf)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* test op loze edges */
|
/* test for loose edges */
|
||||||
ed1= sc->first;
|
ed1= sc->first;
|
||||||
while(ed1) {
|
while(ed1) {
|
||||||
nexted= ed1->next;
|
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)
|
- fill works with its own lists, so create that first (no faces!)
|
||||||
- geef vertices in ->vn de oude pointer mee
|
- for vertices, put in ->vn the old pointer
|
||||||
- alleen xs en ys worden hier niet gebruikt: daar kan je iets in verstoppen
|
- struct elements xs en ys are not used here: don't hide stuff in it
|
||||||
- edge flag ->f wordt 2 als het nieuwe edge betreft
|
- edge flag ->f becomes 2 when it's a new edge
|
||||||
- mode: & 1 is kruispunten testen, edges maken (NOG DOEN )
|
- mode: & 1 is check for crossings, then create edges (TO DO )
|
||||||
*/
|
*/
|
||||||
ListBase tempve, temped;
|
ListBase tempve, temped;
|
||||||
EditVert *eve;
|
EditVert *eve;
|
||||||
@@ -864,7 +858,7 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
|
|||||||
float *minp, *maxp, *v1, *v2, norm[3], len;
|
float *minp, *maxp, *v1, *v2, norm[3], len;
|
||||||
short a,c,poly=0,ok=0,toggle=0;
|
short a,c,poly=0,ok=0,toggle=0;
|
||||||
|
|
||||||
/* variabelen resetten*/
|
/* reset variables */
|
||||||
eve= fillvertbase.first;
|
eve= fillvertbase.first;
|
||||||
while(eve) {
|
while(eve) {
|
||||||
eve->f= 0;
|
eve->f= 0;
|
||||||
@@ -873,8 +867,8 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
|
|||||||
eve= eve->next;
|
eve= eve->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eerst de vertices testen op aanwezigheid in edges */
|
/* first test vertices if they are in edges */
|
||||||
/* plus flaggen resetten */
|
/* including resetting of flags */
|
||||||
eed= filledgebase.first;
|
eed= filledgebase.first;
|
||||||
while(eed) {
|
while(eed) {
|
||||||
eed->f= eed->f1= eed->h= 0;
|
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;
|
if(ok==0) return 0;
|
||||||
|
|
||||||
/* NEW NEW! projektie bepalen: met beste normaal */
|
/* NEW NEW! define projection: with 'best' normal */
|
||||||
/* pak de eerste drie verschillende verts */
|
/* just use the first three different vertices */
|
||||||
|
|
||||||
/* DIT STUK IS NOG STEEDS TAMELIJK ZWAK! */
|
/* THIS PART STILL IS PRETTY WEAK! (ton) */
|
||||||
|
|
||||||
eve= fillvertbase.last;
|
eve= fillvertbase.last;
|
||||||
len= 0.0;
|
len= 0.0;
|
||||||
@@ -918,7 +912,7 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
|
|||||||
eve= eve->next;
|
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[0]= fabs(norm[0]);
|
||||||
norm[1]= fabs(norm[1]);
|
norm[1]= fabs(norm[1]);
|
||||||
@@ -934,13 +928,13 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
|
|||||||
cox= 1; coy= 2;
|
cox= 1; coy= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* STAP 1: AANTAL POLY'S TELLEN */
|
/* STEP 1: COUNT POLYS */
|
||||||
eve= fillvertbase.first;
|
eve= fillvertbase.first;
|
||||||
while(eve) {
|
while(eve) {
|
||||||
/* pak eerste vertex zonder polynummer */
|
/* get first vertex with no poly number */
|
||||||
if(eve->xs==0) {
|
if(eve->xs==0) {
|
||||||
poly++;
|
poly++;
|
||||||
/* nu een soort select connected */
|
/* now a sortof select connected */
|
||||||
ok= 1;
|
ok= 1;
|
||||||
eve->xs= poly;
|
eve->xs= poly;
|
||||||
|
|
||||||
@@ -975,9 +969,9 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
|
|||||||
}
|
}
|
||||||
eve= eve->next;
|
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;
|
eed= filledgebase.first;
|
||||||
while(eed) {
|
while(eed) {
|
||||||
if(eed->v1->h++ >250) break;
|
if(eed->v1->h++ >250) break;
|
||||||
@@ -985,12 +979,12 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
|
|||||||
eed= eed->next;
|
eed= eed->next;
|
||||||
}
|
}
|
||||||
if(eed) {
|
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!");
|
callLocalErrorCallBack("No vertices with 250 edges allowed!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* doet alleen vertices met ->h==1 */
|
/* does it only for vertices with ->h==1 */
|
||||||
testvertexnearedge();
|
testvertexnearedge();
|
||||||
|
|
||||||
ok= 1;
|
ok= 1;
|
||||||
@@ -1023,18 +1017,18 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* STAND VAN ZAKEN:
|
/* CURRENT STATUS:
|
||||||
- eve->f :1= aanwezig in edges
|
- eve->f :1= availalble in edges
|
||||||
- eve->xs :polynummer
|
- eve->xs :polynumber
|
||||||
- eve->h :aantal edges aan vertex
|
- eve->h :amount of edges connected to vertex
|
||||||
- eve->vn :bewaren! oorspronkelijke vertexnummer
|
- eve->vn :store! original vertex number
|
||||||
|
|
||||||
- eed->f :
|
- 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");
|
pflist= (PolyFill *)MEM_callocN(poly*sizeof(PolyFill),"edgefill");
|
||||||
pf= pflist;
|
pf= pflist;
|
||||||
for(a=1;a<=poly;a++) {
|
for(a=1;a<=poly;a++) {
|
||||||
@@ -1064,15 +1058,15 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
|
|||||||
eve= eve->next;
|
eve= eve->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* STAP 4: GATEN OF BOUNDS VINDEN EN SAMENVOEGEN
|
/* STEP 4: FIND HOLES OR BOUNDS, JOIN THEM
|
||||||
* ( bounds alleen om grote hoeveelheden een beetje in stukjes te verdelen,
|
* ( bounds just to divide it in pieces for optimization,
|
||||||
* de edgefill heeft van zichzelf een adequate autogat!!!
|
* the edgefill itself has good auto-hole detection)
|
||||||
* LET OP: WERKT ALLEEN ALS POLY'S GESORTEERD ZIJN!!! */
|
* WATCH IT: ONLY WORKS WITH SORTED POLYS!!! */
|
||||||
|
|
||||||
if(poly>1) {
|
if(poly>1) {
|
||||||
short *polycache, *pc;
|
short *polycache, *pc;
|
||||||
|
|
||||||
/* dus: eerst sorteren */
|
/* so, sort first */
|
||||||
qsort(pflist, poly, sizeof(PolyFill), vergpoly);
|
qsort(pflist, poly, sizeof(PolyFill), vergpoly);
|
||||||
|
|
||||||
/*pf= pflist;
|
/*pf= pflist;
|
||||||
@@ -1087,14 +1081,14 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
|
|||||||
for(a=0; a<poly; a++, pf++) {
|
for(a=0; a<poly; a++, pf++) {
|
||||||
for(c=a+1;c<poly;c++) {
|
for(c=a+1;c<poly;c++) {
|
||||||
|
|
||||||
/* als 'a' inside 'c': samenvoegen (ook bbox)
|
/* if 'a' inside 'c': join (bbox too)
|
||||||
* Pas Op: 'a' kan ook inside andere poly zijn.
|
* Careful: 'a' can also be inside another poly.
|
||||||
*/
|
*/
|
||||||
if(boundisect(pf, pflist+c)) {
|
if(boundisect(pf, pflist+c)) {
|
||||||
*pc= c;
|
*pc= c;
|
||||||
pc++;
|
pc++;
|
||||||
}
|
}
|
||||||
/* alleen voor opt! */
|
/* only for optimize! */
|
||||||
/* else if(pf->max[cox] < (pflist+c)->min[cox]) break; */
|
/* 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;
|
pf= pflist;
|
||||||
/* printf("na merge\n");
|
/* printf("after merge\n");
|
||||||
for(a=1;a<=poly;a++) {
|
for(a=1;a<=poly;a++) {
|
||||||
printf("poly:%d edges:%d verts:%d flag: %d\n",a,pf->edges,pf->verts,pf->f);
|
printf("poly:%d edges:%d verts:%d flag: %d\n",a,pf->edges,pf->verts,pf->f);
|
||||||
pf++;
|
pf++;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
/* STAP 5: DRIEHOEKEN MAKEN */
|
/* STEP 5: MAKE TRIANGLES */
|
||||||
|
|
||||||
tempve.first= fillvertbase.first;
|
tempve.first= fillvertbase.first;
|
||||||
tempve.last= fillvertbase.last;
|
tempve.last= fillvertbase.last;
|
||||||
@@ -1135,12 +1129,12 @@ int BLI_edgefill(int mode) /* DE HOOFD FILL ROUTINE */
|
|||||||
|
|
||||||
/* evl= fillvlakbase.first;
|
/* evl= fillvlakbase.first;
|
||||||
while(evl) {
|
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;
|
evl= evl->next;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
/* VRIJGEVEN */
|
/* FREE */
|
||||||
|
|
||||||
MEM_freeN(pflist);
|
MEM_freeN(pflist);
|
||||||
return 1;
|
return 1;
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h> /* voorkomt dat je bij malloc type moet aangeven */
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -95,7 +95,6 @@ struct statfs {
|
|||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* MAART: #ifndef __FreeBSD__ */
|
|
||||||
#if !defined(__FreeBSD__) && !defined(__APPLE__)
|
#if !defined(__FreeBSD__) && !defined(__APPLE__)
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -144,7 +143,7 @@ char *BLI_getwdN(char *dir)
|
|||||||
|
|
||||||
int BLI_compare(struct direntry *entry1, struct direntry *entry2)
|
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(entry1->type)){
|
||||||
if (S_ISDIR(entry2->type)==0) return (-1);
|
if (S_ISDIR(entry2->type)==0) return (-1);
|
||||||
|
@@ -1,4 +1,8 @@
|
|||||||
/**
|
/* util.c
|
||||||
|
*
|
||||||
|
* various string, file, list operations.
|
||||||
|
*
|
||||||
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||||
@@ -28,7 +32,7 @@
|
|||||||
* Contributor(s): none yet.
|
* Contributor(s): none yet.
|
||||||
*
|
*
|
||||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||||
* Diverse string, file, list operations.
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -104,7 +108,7 @@ int BLI_stringdec(char *string, char *kop, char *staart, unsigned short *numlen)
|
|||||||
|
|
||||||
if (len == len2) {
|
if (len == len2) {
|
||||||
if (len > 4) {
|
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;
|
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, ".tga", 4) == 0) len -= 4;
|
||||||
else if (strncasecmp(string + len - 4, ".jpg", 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);
|
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) {
|
if (add < 0 && digits < 4 && digits > 0) {
|
||||||
int i, exp;
|
int i, exp;
|
||||||
exp = 1;
|
exp = 1;
|
||||||
@@ -258,17 +262,17 @@ void BLI_insertlink(ListBase *listbase, void *vprevlink, void *vnewlink)
|
|||||||
{
|
{
|
||||||
struct Link *prevlink= vprevlink, *newlink= vnewlink;
|
struct Link *prevlink= vprevlink, *newlink= vnewlink;
|
||||||
|
|
||||||
/* newlink komt na prevlink */
|
/* newlink comes after prevlink */
|
||||||
|
|
||||||
if (newlink == 0) return;
|
if (newlink == 0) return;
|
||||||
if (listbase == 0) return;
|
if (listbase == 0) return;
|
||||||
|
|
||||||
if(listbase->first==0) { /* lege lijst */
|
if(listbase->first==0) { /* empty list */
|
||||||
listbase->first= newlink;
|
listbase->first= newlink;
|
||||||
listbase->last= newlink;
|
listbase->last= newlink;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (prevlink== 0) { /* inserten voor eerste element */
|
if (prevlink== 0) { /* insert before first element */
|
||||||
newlink->next= listbase->first;
|
newlink->next= listbase->first;
|
||||||
newlink->prev= 0;
|
newlink->prev= 0;
|
||||||
newlink->next->prev= newlink;
|
newlink->next->prev= newlink;
|
||||||
@@ -276,7 +280,7 @@ void BLI_insertlink(ListBase *listbase, void *vprevlink, void *vnewlink)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listbase->last== prevlink) /* aan einde lijst */
|
if (listbase->last== prevlink) /* at end of list */
|
||||||
listbase->last = newlink;
|
listbase->last = newlink;
|
||||||
|
|
||||||
newlink->next= prevlink->next;
|
newlink->next= prevlink->next;
|
||||||
@@ -289,17 +293,17 @@ void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink)
|
|||||||
{
|
{
|
||||||
struct Link *nextlink= vnextlink, *newlink= vnewlink;
|
struct Link *nextlink= vnextlink, *newlink= vnewlink;
|
||||||
|
|
||||||
/* newlink komt voor nextlink */
|
/* newlink before nextlink */
|
||||||
|
|
||||||
if (newlink == 0) return;
|
if (newlink == 0) return;
|
||||||
if (listbase == 0) return;
|
if (listbase == 0) return;
|
||||||
|
|
||||||
if(listbase->first==0) { /* lege lijst */
|
if(listbase->first==0) { /* empty list */
|
||||||
listbase->first= newlink;
|
listbase->first= newlink;
|
||||||
listbase->last= newlink;
|
listbase->last= newlink;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (nextlink== 0) { /* inserten aan einde lijst */
|
if (nextlink== 0) { /* insert at end of list */
|
||||||
newlink->prev= listbase->last;
|
newlink->prev= listbase->last;
|
||||||
newlink->next= 0;
|
newlink->next= 0;
|
||||||
((struct Link *)listbase->last)->next= newlink;
|
((struct Link *)listbase->last)->next= newlink;
|
||||||
@@ -307,7 +311,7 @@ void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listbase->first== nextlink) /* aan begin lijst */
|
if (listbase->first== nextlink) /* at beginning of list */
|
||||||
listbase->first = newlink;
|
listbase->first = newlink;
|
||||||
|
|
||||||
newlink->next= nextlink;
|
newlink->next= nextlink;
|
||||||
|
Reference in New Issue
Block a user