src/main/java/de/orat/math/cga/impl1/CGA1Multivector.java
public LinePairParameters decomposeLinePair(){
        
        // X soll eine sum aus 1- und 2-blade sein
        // falsch da sind auch zwei 4-blades mit drin
        CGA1Multivector n0 = CGA1Multivector.createBasisVectorOrigin(1d);
        CGA1Multivector ni = CGA1Multivector.createBasisVectorEinf(1d);
        CGA1Multivector X = sub(n0.ip(
                this, LEFT_CONTRACTION).op(CGA1Multivector.createBasisVectorEinf(1d)));
        System.out.println("X="+X.toString(CGA1Metric.baseVectorNames));
        
        // scheint korrekt sum aus 3- und 1-blade
        CGA1Multivector Y = n0.ip(this, LEFT_CONTRACTION);
        System.out.println("Y="+Y.toString(CGA1Metric.baseVectorNames));
        CGA1Multivector Y3 = Y.extractGrade(3);
        System.out.println("Y3="+Y3.toString(CGA1Metric.baseVectorNames));
        
        CGA1Multivector X2 = X.extractGrade(2);
        System.out.println("X2="+X2.toString(CGA1Metric.baseVectorNames));
         // quatrieren und test auf !=0
        CGA1Multivector X22 = X2.gp(X2);
        
        
        // identisch
        if (this.isScalar()){
            return new Decomposition3d.LinePairParameters(0d, null, null);
        // coplanar
        } else if (X2.isNull()){
            // parallel
            if (Y3.op(ni).isNull()){
                Vector3d dir = new Vector3d();
                //TODO
                return new Decomposition3d.LinePairParameters(0d, null, dir);
            // coplanar mit Schnittpunkt    
            } else {
                //TODO
                double alpha=0;
                Point3d p = new Point3d();
                //TODO
                return new Decomposition3d.LinePairParameters(alpha, p, null);
            }
        // skewed
        } else {
            CGA1Multivector d = new CGA1Multivector(Y3.gp(X2.reverse().gp(1d/X2.norm_e2())));
            System.out.println("d="+d.toString(CGA1Metric.baseVectorNames));

            double[] dValues = d.extractCoordinates(2);
         
            double alpha = 0d;
            Vector3d p = new Vector3d(); 
            return new Decomposition3d.LinePairParameters(alpha, new Point3d(p.x,p.y,p.z), 
                    new Vector3d(dValues[0], dValues[1], dValues[2]));
        }
    }
/**
     * Decompose the geometric product of two lines.
     *
     * @return dij and P if l1 and l2 are not coincident and not parallel else an empty array
     */
Decompose the geometric product of two lines.
@return dij and P if l1 and l2 are not coincident and not parallel else an empty array
Decompose the geometric product of two lines . @return dij and P if l1 and l2 are not coincident and not parallel else an empty array
public LinePairParameters decomposeLinePair(){
        CGA1Multivector n0 = CGA1Multivector.createBasisVectorOrigin(1d);
        CGA1Multivector ni = CGA1Multivector.createBasisVectorEinf(1d);
        CGA1Multivector X = sub(n0.ip(
                this, LEFT_CONTRACTION).op(CGA1Multivector.createBasisVectorEinf(1d)));
        System.out.println("X="+X.toString(CGA1Metric.baseVectorNames));
        CGA1Multivector Y = n0.ip(this, LEFT_CONTRACTION);
        System.out.println("Y="+Y.toString(CGA1Metric.baseVectorNames));
        CGA1Multivector Y3 = Y.extractGrade(3);
        System.out.println("Y3="+Y3.toString(CGA1Metric.baseVectorNames));
        CGA1Multivector X2 = X.extractGrade(2);
        System.out.println("X2="+X2.toString(CGA1Metric.baseVectorNames));
        CGA1Multivector X22 = X2.gp(X2);
        if (this.isScalar()){
            return new Decomposition3d.LinePairParameters(0d, null, null);
        } else if (X2.isNull()){
            if (Y3.op(ni).isNull()){
                Vector3d dir = new Vector3d();
                return new Decomposition3d.LinePairParameters(0d, null, dir);
             mit Schnittpunkt    
            } else {
                double alpha=0;
                Point3d p = new Point3d();
                return new Decomposition3d.LinePairParameters(alpha, p, null);
            }
        } else {
            CGA1Multivector d = new CGA1Multivector(Y3.gp(X2.reverse().gp(1d/X2.norm_e2())));
            System.out.println("d="+d.toString(CGA1Metric.baseVectorNames));
            double[] dValues = d.extractCoordinates(2);
            double alpha = 0d;
            Vector3d p = new Vector3d(); 
            return new Decomposition3d.LinePairParameters(alpha, new Point3d(p.x,p.y,p.z), 
                    new Vector3d(dValues[0], dValues[1], dValues[2]));
        }
    }
public LinePairParameters decomposeLinePair ( ) { CGA1Multivector n0 = CGA1Multivector . createBasisVectorOrigin ( 1d ) ; CGA1Multivector ni = CGA1Multivector . createBasisVectorEinf ( 1d ) ; CGA1Multivector X = sub ( n0 . ip ( this , LEFT_CONTRACTION ) . op ( CGA1Multivector . createBasisVectorEinf ( 1d ) ) ) ; System . out . println ( "X=" + X . toString ( CGA1Metric . baseVectorNames ) ) ; CGA1Multivector Y = n0 . ip ( this , LEFT_CONTRACTION ) ; System . out . println ( "Y=" + Y . toString ( CGA1Metric . baseVectorNames ) ) ; CGA1Multivector Y3 = Y . extractGrade ( 3 ) ; System . out . println ( "Y3=" + Y3 . toString ( CGA1Metric . baseVectorNames ) ) ; CGA1Multivector X2 = X . extractGrade ( 2 ) ; System . out . println ( "X2=" + X2 . toString ( CGA1Metric . baseVectorNames ) ) ; CGA1Multivector X22 = X2 . gp ( X2 ) ; if ( this . isScalar ( ) ) { return new Decomposition3d . LinePairParameters ( 0d , null , null ) ; } else if ( X2 . isNull ( ) ) { if ( Y3 . op ( ni ) . isNull ( ) ) { Vector3d dir = new Vector3d ( ) ; return new Decomposition3d . LinePairParameters ( 0d , null , dir ) ; } else { double alpha = 0 ; Point3d p = new Point3d ( ) ; return new Decomposition3d . LinePairParameters ( alpha , p , null ) ; } } else { CGA1Multivector d = new CGA1Multivector ( Y3 . gp ( X2 . reverse ( ) . gp ( 1d / X2 . norm_e2 ( ) ) ) ) ; System . out . println ( "d=" + d . toString ( CGA1Metric . baseVectorNames ) ) ; double [ ] dValues = d . extractCoordinates ( 2 ) ; double alpha = 0d ; Vector3d p = new Vector3d ( ) ; return new Decomposition3d . LinePairParameters ( alpha , new Point3d ( p . x , p . y , p . z ) , new Vector3d ( dValues [ 0 ] , dValues [ 1 ] , dValues [ 2 ] ) ) ; } }
Decompose the geometric product of two lines.
Decompose the geometric product of two lines .
// X soll eine sum aus 1- und 2-blade sein // falsch da sind auch zwei 4-blades mit drin // scheint korrekt sum aus 3- und 1-blade // quatrieren und test auf !=0 // identisch // coplanar // parallel //TODO // coplanar mit Schnittpunkt     //TODO //TODO // skewed