本文整理汇总了C++中intrusive_ptr::GetTriangle方法的典型用法代码示例。如果您正苦于以下问题:C++ intrusive_ptr::GetTriangle方法的具体用法?C++ intrusive_ptr::GetTriangle怎么用?C++ intrusive_ptr::GetTriangle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类intrusive_ptr
的用法示例。
在下文中一共展示了intrusive_ptr::GetTriangle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: triangle
DiffuseAreaLightSource::DiffuseAreaLightSource(const Spectrum_d &i_radiance, intrusive_ptr<const TriangleMesh> ip_mesh): AreaLightSource(ip_mesh),
m_radiance(i_radiance), mp_mesh(ip_mesh)
{
ASSERT(InRange(i_radiance,0.0,DBL_INF));
ASSERT(ip_mesh);
size_t number_of_triangles = ip_mesh->GetNumberOfTriangles();
m_area_CDF.assign(number_of_triangles, 0.0);
for(size_t i=0;i<number_of_triangles;++i)
{
MeshTriangle mesh_triangle = ip_mesh->GetTriangle(i);
Triangle3D_f triangle(
ip_mesh->GetVertex(mesh_triangle.m_vertices[0]),
ip_mesh->GetVertex(mesh_triangle.m_vertices[1]),
ip_mesh->GetVertex(mesh_triangle.m_vertices[2]));
m_area_CDF[i]=triangle.GetArea();
if (i>0) m_area_CDF[i] += m_area_CDF[i-1];
}
if (number_of_triangles > 0)
{
m_area = m_area_CDF.back();
m_inv_area = 1.0 / m_area;
}
else
m_area = m_inv_area = 0.0;
ASSERT(m_area>=0.0);
if (m_area>0.0)
{
double inv_area=1.0/m_area;
for(size_t i=0;i<number_of_triangles;++i)
m_area_CDF[i] *= inv_area;
}
}