コード例 #1
0
Line planePlaneIntersection(const Plane& p1,const Plane& p2)
{
    //Process: http://stackoverflow.com/a/17628505
    Vector normal1=Vector(p1.getA(),p1.getB(),p1.getC()); //vector normal to p1
    Vector normal2=Vector(p2.getA(),p2.getB(),p2.getC()); //vector normal to p2
    Vector cross=Vector::cross(normal1, normal2); //vector parallel to line of intersection
    
    if (fabs(cross.norm())<EPS)
    { //planes are parallel
        Point zero=Point(0,0,0);
        return Line(zero,zero);
    }
    double a1=p1.getA();
    double b1=p1.getB();
    double c1=p1.getC();
    double d1=-1*p1.getD();
    double a2=p2.getA();
    double b2=p2.getB();
    double c2=p2.getC();
    double d2=-1*p2.getD();
    double a3=cross.getX();
    double b3=cross.getY();
    double c3=cross.getZ();
    double d3=0;
    
    //solve with cramers rule
    Matrix3x3 denom(a1,b1,c1,
                    a2,b2,c2,
                    a3,b3,c3);
    Matrix3x3 xNum(d1,b1,c1,
                   d2,b2,c2,
                   d3,b3,c3);
    Matrix3x3 yNum(a1,d1,c1,
                   a2,d2,c2,
                   a3,d3,c3);
    Matrix3x3 zNum(a1,b1,d1,
                   a2,b2,d2,
                   a3,b3,d3);
    double denomDeterminant=denom.determinant();
    
    double xsolution=xNum.determinant()/denomDeterminant;
    double ysolution=yNum.determinant()/denomDeterminant;
    double zsolution=zNum.determinant()/denomDeterminant;
    
    Point onLine(xsolution,ysolution,zsolution);
    Point onLine2=onLine+cross;
    return Line(onLine,onLine2);
}
コード例 #2
0
ファイル: FGLvar.C プロジェクト: koudonojinchuu/magnus
long FGLvar::icQnum(void){
	// returns of edges with index e in the ideal link of companion vertex 
	Boolean returnVal=xNum(GLideal,cv);
	return returnVal;
} 
コード例 #3
0
ファイル: FGLvar.C プロジェクト: koudonojinchuu/magnus
long FGLvar::iQnum(void){
	// returns of edges with index e in the ideal the link of base vertex 

	Boolean returnVal=xNum(GLideal,bv);
	return returnVal;
} 
コード例 #4
0
ファイル: FGLvar.C プロジェクト: koudonojinchuu/magnus
long FGLvar::rcQnum(void){
	// returns number of edges with index e in the real link of companion vertex
	Boolean returnVal=xNum(GLreal,cv);
	return returnVal;
}
コード例 #5
0
ファイル: FGLvar.C プロジェクト: koudonojinchuu/magnus
long FGLvar::rQnum(void){
	// returns number of edges with index e in the real link of base vertex 
	Boolean returnVal=xNum(GLreal,bv);
	return returnVal;
}