本文整理汇总了C++中Plane::a方法的典型用法代码示例。如果您正苦于以下问题:C++ Plane::a方法的具体用法?C++ Plane::a怎么用?C++ Plane::a使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plane
的用法示例。
在下文中一共展示了Plane::a方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reverseEqual
// is this plane reverse equal to the other plane
// true if dot product of outward normals is <= (-1+tol) and abs(d1+d2) <= tol
bool Plane::reverseEqual(const Plane& other, double tol) const
{
double dot = (m_a*other.a() + m_b*other.b() + m_c*other.c());
double dist = m_d + other.d();
bool result = (dot <= -1+tol) && (fabs(dist) <= tol);
return result;
}
示例2: equal
// is this plane equal to the other plane
// true if dot product of outward normals is >= (1-tol) and abs(d1-d2) <= tol
bool Plane::equal(const Plane& other, double tol) const
{
double dot = (m_a*other.a() + m_b*other.b() + m_c*other.c());
double dist = m_d - other.d();
bool result = (dot >= 1-tol) && (fabs(dist) <= tol);
return result;
}
示例3: parallel
bool Plane::parallel(const Plane& other, double tol) const
{
// dot product of outward normals should be 1 or negative 1
double dot = (m_a*other.a() + m_b*other.b() + m_c*other.c());
bool result = (fabs(dot) >= 1.0-tol);
return result;
}
示例4:
Plane::Plane(const Plane& other)
: m_a(other.a()), m_b(other.b()), m_c(other.c()), m_d(other.d())
{
// test that normal has length 1
double length = m_a*m_a + m_b*m_b + m_c*m_c;
double tol = 0.0001;
OS_ASSERT(fabs(1.0-length) < tol);
}
示例5: extract
void Frustum::extract(const Matrix4f &projmatrix,const Matrix4f &viewmatrix)
{
planes->clear();
Plane plane;
Matrix4f matr;
matr=viewmatrix*projmatrix;
// matr.dumpMatrix();
// Kernel::logger() << "\n";
// Left
plane.a(matr[3]+matr[0]);
plane.b(matr[7]+matr[4]);
plane.c(matr[11]+matr[8]);
plane.d(matr[15]+matr[12]);
plane.d(plane.d()/plane.normal().length());
plane.normal().normalize();
planes->push_back(plane);
// Right
plane.a(matr[3]-matr[0]);
plane.b(matr[7]-matr[4]);
plane.c(matr[11]-matr[8]);
plane.d(matr[15]-matr[12]);
plane.d(plane.d()/plane.normal().length());
plane.normal().normalize();
planes->push_back(plane);
// Bottom
plane.a(matr[3]+matr[1]);
plane.b(matr[7]+matr[5]);
plane.c(matr[11]+matr[9]);
plane.d(matr[15]+matr[13]);
plane.d(plane.d()/plane.normal().length());
plane.normal().normalize();
planes->push_back(plane);
// Top
plane.a(matr[3]-matr[1]);
plane.b(matr[7]-matr[5]);
plane.c(matr[11]-matr[9]);
plane.d(matr[15]-matr[13]);
plane.d(plane.d()/plane.normal().length());
plane.normal().normalize();
planes->push_back(plane);
// Near
plane.a(matr[3]+matr[2]);
plane.b(matr[7]+matr[6]);
plane.c(matr[11]+matr[10]);
plane.d(matr[15]+matr[14]);
plane.d(plane.d()/plane.normal().length());
plane.normal().normalize();
planes->push_back(plane);
// Far
plane.a(matr[3]-matr[2]);
plane.b(matr[7]-matr[6]);
plane.c(matr[11]-matr[10]);
plane.d(matr[15]-matr[14]);
plane.d(plane.d()/plane.normal().length());
plane.normal().normalize();
/* projmatrix->dumpMatrix();
printf("]\n%.02f %.02f %.02f %.02f\n",
plane.a(),
plane.b(),
plane.c(),
plane.d());*/
// planes->push_back(plane);
/* p=&frustumPlane[RIGHT];
p->n.x=m[3]-m[0];
p->n.y=m[7]-m[4];
p->n.z=m[11]-m[8];
p->d=m[15]-m[12];
p=&frustumPlane[LEFT];
p->n.x=m[3]+m[0];
p->n.y=m[7]+m[4];
p->n.z=m[11]+m[8];
p->d=m[15]+m[12];
p=&frustumPlane[BOTTOM];
p->n.x=m[3]+m[1];
p->n.y=m[7]+m[5];
p->n.z=m[11]+m[9];
p->d=m[15]+m[13];
p=&frustumPlane[TOP];
p->n.x=m[3]-m[1];
p->n.y=m[7]-m[5];
p->n.z=m[11]-m[9];
p->d=m[15]-m[13];
p=&frustumPlane[PFAR];
p->n.x=m[3]-m[2];
p->n.y=m[7]-m[6];
//.........这里部分代码省略.........
示例6: Oriented_squared_distance2
//**********************************************************************************
//distace of point from a plane (squared) with sign
double Oriented_squared_distance2(Plane P, CGALpoint x){
double h = P.a()*x.x()+P.b()*x.y()+P.c()*x.z()+P.d();
return ((h>0.)-(h<0.))*pow(h,2)/(CGALvector(P.a(),P.b(),P.c())).squared_length();
}