#include <V_3D.h>
Public Member Functions | |
| V_3D () | |
| V_3D (const V_3D &v_3D) | |
| V_3D (double x, double y, double z) | |
| ~V_3D () | |
| int | set (double *v) |
| int | set (int k_dim, double value) |
| int | set (V_3D _V) |
| int | set (double x, double y, double z) |
| double | get (int k_dim) const |
| int | get (double *v) const |
| V_3D | get () const |
| double * | get_pointer () |
| double | dot (V_3D _v) const |
| V_3D | vector_prod (V_3D _v) const |
| double | norm () const |
| V_3D | normalized () const |
| return the normalized vector (if norm>epsilon) | |
| double | area (V_3D _v) const |
| double | cos_angle (const V_3D &v) const |
| double | angle (const V_3D &v) const |
| get acos( a/||a|| . b/||b|| ) | |
| V_3D | get_min_scalar (const V_3D &_v) const |
| V_3D | get_max_scalar (const V_3D &_v) const |
| double | get_max_of_coeff () const |
| double | get_min_of_coeff () const |
| int | equal (const V_3D &v, double epsilon) const |
| double | tetrahedra_volume (const V_3D &p2, const V_3D &p3, const V_3D &p4) const |
| int | get_barycenter_coordinates_tetrahedra (const V_3D &p1, const V_3D &p2, const V_3D &p3, const V_3D &p4, double *alpha, double *beta, double *gamma, double *delta) const |
| int | is_inside_volume (const V_3D &p1, const V_3D &p2, const V_3D &p3, const V_3D &p4) const |
| double | distance_to_oriented_plane (const V_3D &n, const V_3D &x0) const |
| double | cos_angle_to_plane_with_normal (const V_3D &normal_to_plane) const |
| V_3D & | operator= (const V_3D &) |
| V_3D & | operator+= (const V_3D &) |
| V_3D & | operator/= (const double &) |
| bool | operator>= (const V_3D &) const |
| bool | operator> (const V_3D &) const |
| bool | operator<= (const V_3D &) const |
| bool | operator< (const V_3D &) const |
| double & | operator[] (int index) |
| double | operator[] (int index) const |
Private Attributes | |
| double | V [3] |
Friends | |
| V_3D | operator+ (const V_3D &v1, const V_3D &v2) |
| V_3D | operator- (const V_3D &v1, const V_3D &v2) |
| V_3D | operator* (const V_3D &v1, const double &alpha) |
| V_3D | operator* (const double &alpha, const V_3D &v1) |
| V_3D | operator/ (const V_3D &v1, const double &alpha) |
| bool | operator== (const V_3D &v1, const V_3D &v2) |
| bool | operator!= (const V_3D &v1, const V_3D &v2) |
| ostream & | operator<< (ostream &flux, V_3D _v) |
Definition at line 22 of file V_3D.h.
| V_3D::V_3D | ( | ) |
Definition at line 6 of file V_3D.cpp.
References V.
Referenced by normalized().
00007 { 00008 for(int k_dim=0;k_dim<3;k_dim++) 00009 V[k_dim]=0; 00010 }

| V_3D::V_3D | ( | const V_3D & | v_3D | ) |
| V_3D::V_3D | ( | double | x, | |
| double | y, | |||
| double | z | |||
| ) |
| int V_3D::set | ( | double * | v | ) |
Definition at line 28 of file V_3D.cpp.
References V.
Referenced by Mesh_object::build_normal_intermediate(), Mesh_object::build_normal_per_vertex(), Segment::destroy(), Mesh_object::fast_subdivide_barycenter_mid_edge(), Mesh_object::fast_subdivide_mixed_mid_edge(), Skeleton::find_closest_joint(), Matrix::get_position(), Mesh_object::Laplacien_smooth(), Curve_3D::load_curve(), operator*(), operator+(), operator-(), operator/(), Point_set::set_vertex(), and vector_prod().
00029 { 00030 for(int k_dim=0;k_dim<3;k_dim++) 00031 V[k_dim]=_v[k_dim]; 00032 return 0; 00033 }
| int V_3D::set | ( | int | k_dim, | |
| double | value | |||
| ) |
| int V_3D::set | ( | V_3D | _V | ) |
| int V_3D::set | ( | double | x, | |
| double | y, | |||
| double | z | |||
| ) |
| double V_3D::get | ( | int | k_dim | ) | const |
Definition at line 55 of file V_3D.cpp.
References V.
Referenced by dot(), operator*(), operator<<(), set(), and vector_prod().
00056 { 00057 return V[k_dim]; 00058 }

| int V_3D::get | ( | double * | v | ) | const |
| V_3D V_3D::get | ( | ) | const |
| double * V_3D::get_pointer | ( | ) |
| double V_3D::dot | ( | V_3D | _v | ) | const |
Definition at line 124 of file V_3D.cpp.
Referenced by Matrix::build_rotation_matrix_to_vector(), Segment::closest_to_segment(), cos_angle(), cos_angle_to_plane_with_normal(), distance_to_oriented_plane(), Joint::get_min_distance_to_bone(), Skinned::get_vertex_to_bone_distance(), Segment::plane_intersection(), and tetrahedra_volume().
00125 { 00126 double res=0.0; 00127 int k_dim=0; 00128 for(k_dim=0;k_dim<3;k_dim++) 00129 res += V[k_dim]*_v.get(k_dim); 00130 return res; 00131 }


Definition at line 150 of file V_3D.cpp.
References get(), set(), and V.
Referenced by area(), Matrix::build_rotation_matrix_to_vector(), Triangle::normal(), and tetrahedra_volume().
00151 { 00152 V_3D res; 00153 00154 res.set(0,V[1]*_v.get(2)-V[2]*_v.get(1)); 00155 res.set(1,V[2]*_v.get(0)-V[0]*_v.get(2)); 00156 res.set(2,V[0]*_v.get(1)-V[1]*_v.get(0)); 00157 00158 return res; 00159 }


| double V_3D::norm | ( | ) | const |
Definition at line 133 of file V_3D.cpp.
References V.
Referenced by area(), cos_angle(), cos_angle_to_plane_with_normal(), distance_to_oriented_plane(), normalized(), and Skinned::skinning().
00134 { 00135 double res=0.0; 00136 int k_dim=0; 00137 for(k_dim=0;k_dim<3;k_dim++) 00138 res += V[k_dim]*V[k_dim]; 00139 00140 return powf(res,0.5); 00141 }

| V_3D V_3D::normalized | ( | ) | const |
return the normalized vector (if norm>epsilon)
return the normalized vector if norm is >0, return vector (0,0,1) if the norm is null
Definition at line 359 of file V_3D.cpp.
References norm(), and V_3D().
Referenced by Mesh_object::build_normal_intermediate(), Mesh_object::build_normal_per_vertex(), Matrix::build_rotation_matrix_to_vector(), Triangle::normal(), and Segment::unit_vector().
00360 { 00361 double epsilon=0.00001; 00362 double current_norm=norm(); 00363 if(current_norm<epsilon) 00364 { 00365 //printf("Error norm is zero in [V_3D].normalized() function\n"); 00366 return V_3D(0,0,1); 00367 } 00368 return (*this)/current_norm; 00369 }


| double V_3D::area | ( | V_3D | _v | ) | const |
Definition at line 161 of file V_3D.cpp.
References norm(), and vector_prod().
00162 { 00163 return vector_prod(_v).norm()/2; 00164 }

| double V_3D::cos_angle | ( | const V_3D & | v | ) | const |
| double V_3D::angle | ( | const V_3D & | v | ) | const |
get acos( a/||a|| . b/||b|| )
Definition at line 339 of file V_3D.cpp.
References cos_angle().
Referenced by Mesh_object::build_normal_intermediate().
00340 {return acos(cos_angle(v));}


Definition at line 224 of file V_3D.cpp.
References V.
Referenced by Point_set::inside_box(), and Point_set::outside_box().
00225 { 00226 V_3D temp; 00227 for(int k_dim=0;k_dim<3;k_dim++) 00228 temp[k_dim]=(V[k_dim]<_v[k_dim]?V[k_dim]:_v[k_dim]); 00229 return temp; 00230 }

Definition at line 231 of file V_3D.cpp.
References V.
Referenced by Point_set::inside_box(), and Point_set::outside_box().
00232 { 00233 V_3D temp; 00234 for(int k_dim=0;k_dim<3;k_dim++) 00235 temp[k_dim]=(V[k_dim]>_v[k_dim]?V[k_dim]:_v[k_dim]); 00236 return temp; 00237 }

| double V_3D::get_max_of_coeff | ( | ) | const |
Definition at line 239 of file V_3D.cpp.
References V.
Referenced by Point_set::export_visible_off(), and Point_set::unitize_size().

| double V_3D::get_min_of_coeff | ( | ) | const |
| int V_3D::equal | ( | const V_3D & | v, | |
| double | epsilon | |||
| ) | const |
Definition at line 278 of file V_3D.cpp.
References dot(), and vector_prod().
Referenced by get_barycenter_coordinates_tetrahedra().
00279 { 00280 //compute 00281 // V = 1/2*det(A,B,C,D) = 1/2* (ABxAC).AD 00282 00283 V_3D AB=p2-*this; 00284 V_3D AC=p3-*this; 00285 V_3D AD=p4-*this; 00286 00287 double Vol=0.0; 00288 Vol = 0.5 * (AB.vector_prod(AC)).dot(AD); 00289 return Vol; 00290 }


| int V_3D::get_barycenter_coordinates_tetrahedra | ( | const V_3D & | p1, | |
| const V_3D & | p2, | |||
| const V_3D & | p3, | |||
| const V_3D & | p4, | |||
| double * | alpha, | |||
| double * | beta, | |||
| double * | gamma, | |||
| double * | delta | |||
| ) | const |
Definition at line 292 of file V_3D.cpp.
References tetrahedra_volume().
Referenced by is_inside_volume().
00293 { 00294 double Va=(*this).tetrahedra_volume(p2,p3,p4); 00295 double Vb=p1.tetrahedra_volume(*this,p3,p4); 00296 double Vc=p1.tetrahedra_volume(p2,*this,p4); 00297 double Vd=p1.tetrahedra_volume(p2,p3,*this); 00298 double Vtot=p1.tetrahedra_volume(p2,p3,p4); 00299 00300 *alpha=Va/Vtot; 00301 *beta =Vb/Vtot; 00302 *gamma=Vc/Vtot; 00303 *delta=Vd/Vtot; 00304 00305 return 0; 00306 }


| int V_3D::is_inside_volume | ( | const V_3D & | p1, | |
| const V_3D & | p2, | |||
| const V_3D & | p3, | |||
| const V_3D & | p4 | |||
| ) | const |
Definition at line 308 of file V_3D.cpp.
References get_barycenter_coordinates_tetrahedra().
Referenced by Point_set::inside_tetrahedra(), and Point_set::outside_tetrahedra().
00309 { 00310 double alpha=0.0,beta=0.0,gamma=0.0,delta=0.0; 00311 get_barycenter_coordinates_tetrahedra(p1,p2,p3,p4,&alpha,&beta,&gamma,&delta); 00312 00313 if(alpha>0 && beta>0 && gamma>0 && delta>0) 00314 return 1; 00315 return 0; 00316 }


Definition at line 318 of file V_3D.cpp.
Referenced by Point_set::in_half_space().
00319 { 00320 //normalize 00321 double epsilon=0.000001; 00322 double norm_n=n.norm(); 00323 if(norm_n<epsilon) 00324 {printf("Error n is null in distance to oriented_plane in V_3D...\n");exit(-1);} 00325 V_3D n_normalized=n/norm_n; 00326 00327 double proj = ((*this)-x0).dot(n_normalized); 00328 return proj; 00329 }


| double V_3D::cos_angle_to_plane_with_normal | ( | const V_3D & | normal_to_plane | ) | const |
get the angle between the vector and the plane defined by the normal normal_to_plane cos(Angle) = <u,(u-<u,n>)/||u-<u,n>||>
Definition at line 342 of file V_3D.cpp.
00343 { 00344 double norm_normal=normal_to_plane.norm(); 00345 if(norm_normal<=0.000001) 00346 {printf("Error in angle_to_plane_with_normal in V_3D, normal has norm=0\n");exit(-1);} 00347 double current_norm=norm(); 00348 V_3D this_normed = (*this)/current_norm; 00349 V_3D projected = this_normed - (this_normed.dot(normal_to_plane))*normal_to_plane; 00350 double projected_norm= this_normed.norm(); 00351 if(projected_norm<0.00001) 00352 {printf("Error in angle_to_plane_with_normal in V_3D, projected_normal has norm=0\n");exit(-1);} 00353 projected = projected/projected_norm; 00354 double dot_prod=this_normed.dot(projected); 00355 00356 return dot_prod; 00357 }

| V_3D & V_3D::operator/= | ( | const double & | alpha | ) |
| bool V_3D::operator>= | ( | const V_3D & | v | ) | const |
| bool V_3D::operator> | ( | const V_3D & | v | ) | const |
| bool V_3D::operator<= | ( | const V_3D & | v | ) | const |
| bool V_3D::operator< | ( | const V_3D & | v | ) | const |
| double & V_3D::operator[] | ( | int | index | ) |
| double V_3D::operator[] | ( | int | index | ) | const |
| ostream& operator<< | ( | ostream & | flux, | |
| V_3D | _v | |||
| ) | [friend] |
double V_3D::V[3] [private] |
Definition at line 98 of file V_3D.h.
Referenced by dot(), equal(), get(), get_max_of_coeff(), get_max_scalar(), get_min_of_coeff(), get_min_scalar(), get_pointer(), norm(), operator!=(), operator*(), operator+(), operator+=(), operator-(), operator/(), operator/=(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), operator[](), set(), V_3D(), and vector_prod().
1.5.6