57 if (val <
epsilon)
return false;
58 (*this) = (*this)/val;
79 const Real cos_angle = (
inner(*
this, vv))/ll;
81 if ( cos_angle >= cos_tol )
83 else if ( cos_angle <= -cos_tol )
114 return (
v[0] != 0.0 ||
v[1] != 0.0) ?
true :
false;
129 fprintf(fp,
"(%lg", v[0]);
130 for(
int i = 1; i < 2;++i){
131 fprintf(fp,
" %lg", v[i]);
150 for (
int i = 0 ; i < 2 ;++i){
161 for (
int i = 0 ; i < 2 ;++i){
177 if (val <
epsilon)
return false;
178 (*this) = (*this)/val;
199 const Real cos_angle = (
inner(*
this, vv))/ll;
201 if ( cos_angle >= cos_tol )
203 else if ( cos_angle <= -cos_tol )
233 if ( fabs(vv[1]) > fabs(vv[0]) ) {
234 if ( fabs(vv[2]) > fabs(vv[1]) ) {
241 else if ( fabs(vv[2]) >= fabs(vv[0]) ){
257 else if ( fabs(vv[2]) > fabs(vv[0]) ) {
265 else if ( fabs(vv[2]) > fabs(vv[1]) ) {
285 return (a != 0.0) ?
true :
false;
294 vec3 V0, V1, V2, N0, N1, N2;
296 v[0] =
v[1] =
v[2] = 0.0;
302 N0 =
cross( V1, V2 );
307 N1 =
cross( V2, V0 );
312 N2 =
cross( V0, V1 );
346 fprintf(fp,
"(%lg", v[0]);
347 for(
int i = 1; i < 3;++i){
348 fprintf(fp,
" %lg", v[i]);
367 for (
int i = 0 ; i < 3 ;++i){
378 for (
int i = 0 ; i < 3 ;++i){
393 if (val <
epsilon)
return false;
394 (*this) = (*this)/val;
405 fprintf(fp,
"(%lg", v[0]);
406 for(
int i = 1; i < 4;++i){
407 fprintf(fp,
" %lg", v[i]);
426 for (
int i = 0 ; i < 4 ;++i){
437 for (
int i = 0 ; i < 4 ;++i){
448 c(0) = a(0 + 1) * b(0 + 2) - a(0 + 2) * b(0 + 1);
450 c(1) = a(1 + 1) * b(1 + 2) - a(1 + 2) * b(1 + 1);
452 c(2) = a(2 + 1) * b(2 + 2) - a(2 + 2) * b(2 + 1);
Real inner(const vec2 &a, const vec2 &b)
bool is_perpendicular(const vec3 &, Real=angle_tolerance) const
int is_parallel(const vec3 &, Real=angle_tolerance) const
int is_parallel(const vec2 &, Real=angle_tolerance) const
void store(FILE *fp, const vec2 &v)
int apx_equal(Real x, Real y)
vec3 cross(const vec3 &a, const vec3 &b)
bool perpendicular(const vec3 &)
structure for 2-dimensional Real type vector and its arithmetic.
bool perpendicular(const vec2 &)
structure for 3-dimensional Real type vector and its arithmetic.
structure for 4-dimensional Real type vector and its arithmetic.
bool is_perpendicular(const vec2 &, Real=angle_tolerance) const