本文整理汇总了C++中Triangle::Area方法的典型用法代码示例。如果您正苦于以下问题:C++ Triangle::Area方法的具体用法?C++ Triangle::Area怎么用?C++ Triangle::Area使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Triangle
的用法示例。
在下文中一共展示了Triangle::Area方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Area
/*virtual*/ bool Triangle::CalculateSurfacePoint(const Scene::Ray& ray, const Scene& scene, Scene::SurfacePoint& surfacePoint) const
{
Plane plane;
plane.center = vertex[0];
plane.normal = c3ga::unit( c3ga::gp( c3ga::op( vertex[1] - vertex[0], vertex[2] - vertex[0] ), c3ga::I3 ) );
if( !plane.CalculateSurfacePoint( ray, scene, surfacePoint ) )
return false;
double area = Area();
double totalSubArea = 0.0;
for( int i = 0; i < 3; i++ )
{
Triangle subTriangle;
c3ga::vectorE3GA* vertexPtr = subTriangle.vertex;
*vertexPtr++ = surfacePoint.point;
for( int j = 0; j < 3; j++ )
if( j != i )
*vertexPtr++ = vertex[j];
double subArea = subTriangle.Area();
totalSubArea += subArea;
}
double eps = 1e-4;
if( fabs( totalSubArea - area ) < eps )
return true;
return false;
}
示例2:
BaseBuilding::BaseBuilding(const Triangle& t, const unsigned int& typeCentre, const double& heightMax)
{
listPoints.push_back(t[0]);
listPoints.push_back(t[1]);
listPoints.push_back(t[2]);
airMin = t.Area()*0.3;
setBuildingInfo(typeCentre, heightMax);
}
示例3:
Batiment::Batiment(const Triangle& t, const unsigned int& typeCentre, const double& hauteurMax)
{
listePoints.push_back(t[0]);
listePoints.push_back(t[1]);
listePoints.push_back(t[2]);
airMin = t.Area()*0.3;
setBatimentInfos(typeCentre, hauteurMax);
}
示例4: main
int main() {
int i;
double a[2] = { 0.0, 0.0 };
double b[2] = { 0.0, 2.0 };
double c[2] = { 2.0, 0.0 };
Triangle* tri = new Triangle( a, b, c, TRI_ORDER );
cout << "triangle area: " << tri->Area() << endl;
cout << "triangle vertices: " << endl;
cout << "[" << tri->a[0] << "," << tri->a[1] << "]" << endl;
cout << "[" << tri->b[0] << "," << tri->b[1] << "]" << endl;
cout << "[" << tri->c[0] << "," << tri->c[1] << "]" << endl;
cout << "quadrature coords: " << endl;
for( i = 0; i < tri->nq; i++ ) {
cout << "[" << tri->qi[i][0] << "," << tri->qi[i][1] << "]" << endl;
}
return 1;
}