src/main/java/de/orat/math/cga/api/CGAMultivector.java
public static Decomposition3d.LinePairParameters decomposeLinePair(CGAMultivector l2l1){
        
        System.out.println("l2l1:"+l2l1.toString());
        
        // Skalar
        double cosalpha = l2l1.impl.extractCoordinates(0)[0];
        System.out.println("cosalpha="+String.valueOf(cosalpha));
        System.out.println("alpha="+String.valueOf(Math.acos(cosalpha)*180/Math.PI));
       
        // Bivektoren 
        double[] bivectors = l2l1.impl.extractCoordinates(2);
        double[] quadvectors = l2l1.impl.extractCoordinates(4);
        
        // attitude zeigt von l1 nach l2?
        
        double dist = 0d;
        double sinalpha = 0;
        
        org.jogamp.vecmath.Vector3d attitude = null;
        
        // Geraden nicht senkrecht zueinander
        if (cosalpha != 0){
            System.out.println("attitude aus e01, e02 und e03 bestimmen!");
            attitude = new org.jogamp.vecmath.Vector3d(
                -bivectors[0]/cosalpha, -bivectors[1]/cosalpha, -bivectors[2]/cosalpha);
            System.out.println("d(vectors)= ("+String.valueOf(attitude.x)+", "+String.valueOf(attitude.y)+", "+String.valueOf(attitude.z)+")");
            dist = attitude.length();
            System.out.println("dist = "+dist);
            attitude.normalize();
            System.out.println("d(vectors) normiert= ("+String.valueOf(attitude.x)+", "+String.valueOf(attitude.y)+", "+String.valueOf(attitude.z)+")");
            
        } 
            
        // Geraden sind nicht parallel
        if (cosalpha*cosalpha != 1){
            System.out.println("attitude aus e23, e13, e12 und e0123 bestimmen!");
            double cos2alpha = 1d-cosalpha*cosalpha;
            attitude = new org.jogamp.vecmath.Vector3d(
                -bivectors[7]*quadvectors[0]/cos2alpha, 
                 bivectors[5]*quadvectors[0]/cos2alpha, 
                -bivectors[4]*quadvectors[0]/cos2alpha);
            System.out.println("d(vectors)= ("+String.valueOf(attitude.x)+", "+String.valueOf(attitude.y)+", "+String.valueOf(attitude.z)+")");
            dist = attitude.length();
            System.out.println("dist = "+dist);
            attitude.normalize();
            System.out.println("d(vectors) normiert= ("+String.valueOf(attitude.x)+", "+String.valueOf(attitude.y)+", "+String.valueOf(attitude.z)+")");
            
        } 
         
        // Geraden haben keinen Schnittpunkt
        if (dist != 0d){
            sinalpha = -quadvectors[0]/dist;
        } else {
            System.out.println("Geraden schneiden sich!");
            //FIXME
            // ist das so richtig?
            sinalpha = 0d;
        }
        //TODO
        Point3d location = null;
        
        return new Decomposition3d.LinePairParameters(Math.atan2(cosalpha, sinalpha), location, attitude);
    }
/**
      * Decompose l2l1 into angle, distance, direction.
      * 
      * A Covariant approach to Geometry using Geometric Algebra.
      * Technical report. Universit of Cambridge Departement of Engineering, 
      * Cambridge, UK (2004). 
      * A. Lasenby, J. Lasenby, R. Wareham
      * Formula 5.22, page 46
      * 
      * @param l2l1
      * @return parameters describing the pose of two lines to each other
      */
Decompose l2l1 into angle, distance, direction.

A Covariant approach to Geometry using Geometric Algebra.
Technical report. Universit of Cambridge Departement of Engineering,
Cambridge, UK (2004).
A. Lasenby, J. Lasenby, R. Wareham
Formula 5.22, page 46

@param l2l1
@return parameters describing the pose of two lines to each other
Decompose l2l1 into angle distance direction . A Covariant approach to Geometry using Geometric Algebra . Technical report . Universit of Cambridge Departement of Engineering Cambridge UK ( 2004 ) . A . Lasenby J . Lasenby R . Wareham Formula 5 . 22 page 46 @param l2l1 @return parameters describing the pose of two lines to each other
public static Decomposition3d.LinePairParameters decomposeLinePair(CGAMultivector l2l1){
        System.out.println("l2l1:"+l2l1.toString());
        double cosalpha = l2l1.impl.extractCoordinates(0)[0];
        System.out.println("cosalpha="+String.valueOf(cosalpha));
        System.out.println("alpha="+String.valueOf(Math.acos(cosalpha)*180/Math.PI));
        double[] bivectors = l2l1.impl.extractCoordinates(2);
        double[] quadvectors = l2l1.impl.extractCoordinates(4);
        double dist = 0d;
        double sinalpha = 0;
        org.jogamp.vecmath.Vector3d attitude = null;
        if (cosalpha != 0){
            System.out.println("attitude aus e01, e02 und e03 bestimmen!");
            attitude = new org.jogamp.vecmath.Vector3d(
                -bivectors[0]/cosalpha, -bivectors[1]/cosalpha, -bivectors[2]/cosalpha);
            System.out.println("d(vectors)= ("+String.valueOf(attitude.x)+", "+String.valueOf(attitude.y)+", "+String.valueOf(attitude.z)+")");
            dist = attitude.length();
            System.out.println("dist = "+dist);
            attitude.normalize();
            System.out.println("d(vectors) normiert= ("+String.valueOf(attitude.x)+", "+String.valueOf(attitude.y)+", "+String.valueOf(attitude.z)+")");
        } 
        if (cosalpha*cosalpha != 1){
            System.out.println("attitude aus e23, e13, e12 und e0123 bestimmen!");
            double cos2alpha = 1d-cosalpha*cosalpha;
            attitude = new org.jogamp.vecmath.Vector3d(
                -bivectors[7]*quadvectors[0]/cos2alpha, 
                 bivectors[5]*quadvectors[0]/cos2alpha, 
                -bivectors[4]*quadvectors[0]/cos2alpha);
            System.out.println("d(vectors)= ("+String.valueOf(attitude.x)+", "+String.valueOf(attitude.y)+", "+String.valueOf(attitude.z)+")");
            dist = attitude.length();
            System.out.println("dist = "+dist);
            attitude.normalize();
            System.out.println("d(vectors) normiert= ("+String.valueOf(attitude.x)+", "+String.valueOf(attitude.y)+", "+String.valueOf(attitude.z)+")");
        } 
        if (dist != 0d){
            sinalpha = -quadvectors[0]/dist;
        } else {
            System.out.println("Geraden schneiden sich!");
            sinalpha = 0d;
        }
        Point3d location = null;
        return new Decomposition3d.LinePairParameters(Math.atan2(cosalpha, sinalpha), location, attitude);
    }
public static Decomposition3d . LinePairParameters decomposeLinePair ( CGAMultivector l2l1 ) { System . out . println ( "l2l1:" + l2l1 . toString ( ) ) ; double cosalpha = l2l1 . impl . extractCoordinates ( 0 ) [ 0 ] ; System . out . println ( "cosalpha=" + String . valueOf ( cosalpha ) ) ; System . out . println ( "alpha=" + String . valueOf ( Math . acos ( cosalpha ) * 180 / Math . PI ) ) ; double [ ] bivectors = l2l1 . impl . extractCoordinates ( 2 ) ; double [ ] quadvectors = l2l1 . impl . extractCoordinates ( 4 ) ; double dist = 0d ; double sinalpha = 0 ; org . jogamp . vecmath . Vector3d attitude = null ; if ( cosalpha != 0 ) { System . out . println ( "attitude aus e01, e02 und e03 bestimmen!" ) ; attitude = new org . jogamp . vecmath . Vector3d ( - bivectors [ 0 ] / cosalpha , - bivectors [ 1 ] / cosalpha , - bivectors [ 2 ] / cosalpha ) ; System . out . println ( "d(vectors)= (" + String . valueOf ( attitude . x ) + ", " + String . valueOf ( attitude . y ) + ", " + String . valueOf ( attitude . z ) + ")" ) ; dist = attitude . length ( ) ; System . out . println ( "dist = " + dist ) ; attitude . normalize ( ) ; System . out . println ( "d(vectors) normiert= (" + String . valueOf ( attitude . x ) + ", " + String . valueOf ( attitude . y ) + ", " + String . valueOf ( attitude . z ) + ")" ) ; } if ( cosalpha * cosalpha != 1 ) { System . out . println ( "attitude aus e23, e13, e12 und e0123 bestimmen!" ) ; double cos2alpha = 1d - cosalpha * cosalpha ; attitude = new org . jogamp . vecmath . Vector3d ( - bivectors [ 7 ] * quadvectors [ 0 ] / cos2alpha , bivectors [ 5 ] * quadvectors [ 0 ] / cos2alpha , - bivectors [ 4 ] * quadvectors [ 0 ] / cos2alpha ) ; System . out . println ( "d(vectors)= (" + String . valueOf ( attitude . x ) + ", " + String . valueOf ( attitude . y ) + ", " + String . valueOf ( attitude . z ) + ")" ) ; dist = attitude . length ( ) ; System . out . println ( "dist = " + dist ) ; attitude . normalize ( ) ; System . out . println ( "d(vectors) normiert= (" + String . valueOf ( attitude . x ) + ", " + String . valueOf ( attitude . y ) + ", " + String . valueOf ( attitude . z ) + ")" ) ; } if ( dist != 0d ) { sinalpha = - quadvectors [ 0 ] / dist ; } else { System . out . println ( "Geraden schneiden sich!" ) ; sinalpha = 0d ; } Point3d location = null ; return new Decomposition3d . LinePairParameters ( Math . atan2 ( cosalpha , sinalpha ) , location , attitude ) ; }
Decompose l2l1 into angle, distance, direction.
Decompose l2l1 into angle distance direction .
// Skalar // Bivektoren  // attitude zeigt von l1 nach l2? // Geraden nicht senkrecht zueinander // Geraden sind nicht parallel // Geraden haben keinen Schnittpunkt //FIXME // ist das so richtig? //TODO