26 deque<CGAL_Point3> vertices =
build_box(w, h, _source, _receptor);
32 CGAL_Transform3 to_box_system(vx.x(), vx.y(), vx.z(), vy.x(), vy.y(), vy.z(), vz.x(), vz.y(), vz.z());
35 deque<CGAL_Point3> cgal_nodes;
36 for (nodes_pool_t::const_iterator it = nodes.begin(); it != nodes.end(); it++)
38 cgal_nodes.push_back(
CGAL_Point3(it->_x, it->_y, it->_z).transform(to_box_system));
41 for (triangle_pool_t::const_iterator it = triangle_soup.begin(); it != triangle_soup.end(); it++)
43 cgal_triangles.push_back(
44 CGAL_Triangle(cgal_nodes[it->n[0]], cgal_nodes[it->n[1]], cgal_nodes[it->n[2]]));
46 float l = (float)sqrt(
CGAL_Vector3(_source, _receptor).squared_length());
50 std::deque<CGAL_Point3> box_triangle;
51 box_triangle.push_back(vertices[1].transform(to_box_system));
52 box_triangle.push_back(vertices[2].transform(to_box_system));
53 box_triangle.push_back(vertices[3].transform(to_box_system));
59 all_nodes.push_back(p);
60 return all_nodes.size() - 1;
73 return all_triangles.size() - 1;
76 material_ptr_t AcousticProblemModel::make_material(
const string&
name,
double resistivity,
double deviation,
77 double length,
double factor_g)
80 shared_ptr<AcousticGroundMaterial> ptr =
nullptr;
83 for (
auto iter = all_materials.begin(); iter != all_materials.end(); ++iter)
85 ptr = tympan::dynamic_pointer_cast<AcousticGroundMaterial>(*iter);
89 if (ptr->compare(
name, resistivity, deviation, length, factor_g))
102 p_mat = tympan::static_pointer_cast<AcousticMaterialBase>(
103 tympan::make_shared<AcousticGroundMaterial>(
name, resistivity, deviation, length, factor_g));
104 all_materials.push_back(p_mat);
111 material_ptr_t p_mat = tympan::static_pointer_cast<AcousticMaterialBase>(
112 tympan::make_shared<AcousticBuildingMaterial>(
name, spectrum));
113 all_materials.push_back(p_mat);
121 all_sources.push_back(
AcousticSource(point, spectrum, directivity));
122 return all_sources.size() - 1;
128 return all_receptors.size() - 1;
This file provides the top-level declaration for the acoustic problem model.
Class to describe the acoustic problem.
Describes an acoustic receptor.
Describes an acoustic source.
Interface for source directivity classes (SphericalSourceDirectivity, CommonFaceDirectivity,...
CGAL_Vector3 normalize(CGAL_Vector3 v)
normalize vector v
CGAL::Triangle_3< CGAL_Gt > CGAL_Triangle
CGAL_Plane to_cgal(const OPlan &oplan)
Convert a OPlan to CGAL_Plane.
CGAL::Point_3< CGAL_Gt > CGAL_Point3
CGAL::Vector_3< CGAL_Gt > CGAL_Vector3
std::deque< CGAL_Triangle > CGAL_Triangles
deque< triangle_idx > scene_volume_intersection(const triangle_pool_t &triangle_soup, const nodes_pool_t &nodes, float w, float h, OPoint3D source, OPoint3D receptor)
Find the intersection between some triangles (triangles, nodes) and a volume given by a width,...
std::deque< Point > nodes_pool_t
std::unique_ptr< AcousticProblemModel > make_AcousticProblemModel()
std::deque< CGAL_Point3 > build_box(float w, float h, CGAL_Point3 pta, CGAL_Point3 ptb)
return 4 points defining a 3D parallelepiped
CGAL::Aff_transformation_3< CGAL_Gt > CGAL_Transform3
shared_ptr< AcousticMaterialBase > material_ptr_t
std::deque< AcousticTriangle > triangle_pool_t
Array of AcousticTriangle.
std::deque< size_t > intersected_triangles(CGAL_Triangles &triangle_soup, std::deque< CGAL_Point3 > query_box, float length, float width, float height)
Find the triangles from triangle_soup that are intersected by the 3D box including the points of quer...