added len_squared_v2v2, use instead of len_v3v3 for font handle tests, also fixed some warnings.

This commit is contained in:
Campbell Barton
2010-10-03 14:16:27 +00:00
parent ed7ffb111a
commit 157d1205a4
5 changed files with 23 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
/*
/***************************************************************************************************
**

View File

@@ -95,6 +95,7 @@ MINLINE void star_m3_v3(float R[3][3],float a[3]);
MINLINE float len_v2(const float a[2]);
MINLINE float len_v2v2(const float a[2], const float b[2]);
MINLINE float len_squared_v2v2(const float a[3], const float b[3]);
MINLINE float len_v3(const float a[3]);
MINLINE float len_v3v3(const float a[3], const float b[3]);
MINLINE float len_squared_v3v3(const float a[3], const float b[3]);

View File

@@ -252,15 +252,15 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
}
// get the handles that are aligned, tricky...
// DistVL2Dfl, check if the three beztriple points are on one line
// VecLenf, see if there's a distance between the three points
// VecLenf again, to check the angle between the handles
// dist_to_line_v2, check if the three beztriple points are on one line
// len_squared_v2v2, see if there's a distance between the three points
// len_squared_v2v2 again, to check the angle between the handles
// finally, check if one of them is a vector handle
if((dist_to_line_v2(bezt->vec[0],bezt->vec[1],bezt->vec[2]) < 0.001) &&
(len_v3v3(bezt->vec[0], bezt->vec[1]) > 0.0001) &&
(len_v3v3(bezt->vec[1], bezt->vec[2]) > 0.0001) &&
(len_v3v3(bezt->vec[0], bezt->vec[2]) > 0.0002) &&
(len_v3v3(bezt->vec[0], bezt->vec[2]) > MAX2(len_v3v3(bezt->vec[0], bezt->vec[1]), len_v3v3(bezt->vec[1], bezt->vec[2]))) &&
(len_squared_v2v2(bezt->vec[0], bezt->vec[1]) > 0.0001*0.0001) &&
(len_squared_v2v2(bezt->vec[1], bezt->vec[2]) > 0.0001*0.0001) &&
(len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > 0.0002*0.0001) &&
(len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > MAX2(len_squared_v2v2(bezt->vec[0], bezt->vec[1]), len_squared_v2v2(bezt->vec[1], bezt->vec[2]))) &&
bezt->h1 != HD_VECT && bezt->h2 != HD_VECT)
{
bezt->h1= bezt->h2= HD_ALIGN;

View File

@@ -302,7 +302,7 @@ MINLINE void star_m3_v3(float mat[][3], float *vec)
MINLINE float len_v2(const float v[2])
{
return (float)sqrt(v[0]*v[0] + v[1]*v[1]);
return (float)sqrtf(v[0]*v[0] + v[1]*v[1]);
}
MINLINE float len_v2v2(const float v1[2], const float v2[2])
@@ -311,7 +311,7 @@ MINLINE float len_v2v2(const float v1[2], const float v2[2])
x = v1[0]-v2[0];
y = v1[1]-v2[1];
return (float)sqrt(x*x+y*y);
return (float)sqrtf(x*x+y*y);
}
MINLINE float len_v3(const float a[3])
@@ -319,6 +319,14 @@ MINLINE float len_v3(const float a[3])
return sqrtf(dot_v3v3(a, a));
}
MINLINE float len_squared_v2v2(const float a[3], const float b[3])
{
float d[2];
sub_v2_v2v2(d, b, a);
return dot_v2v2(d, d);
}
MINLINE float len_v3v3(const float a[3], const float b[3])
{
float d[3];

View File

@@ -49,6 +49,10 @@
#include "BKE_image.h"
#include "BKE_paint.h"
#ifdef WITH_LCMS
#include "BKE_colortools.h"
#endif
#include "BIF_gl.h"
#include "BIF_glutil.h"