View Javadoc

1   // GeometricAlgebra Java package file
2   // Current version
3   // Go to ... http://sinai.mech.fukui-u.ac.jp/gcj/software/KamiWaAi/index.html
4   // Copyright (C) 2003, Eckhard M.S. Hitzer
5   //
6   // This library is free software; you can redistribute it and/or
7   // modify it under the terms of the GNU Lesser General Public
8   // License as published by the Free Software Foundation; either
9   // version 2.1 of the License, or any later version.
10  //
11  // This library is distributed in the hope that it will be useful,
12  // but WITHOUT ANY WARRANTY; without even the implied warranty of
13  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  // Lesser General Public License for more details.
15  //
16  // You should have received a copy of the GNU Lesser General Public
17  // License along with this library; if not, write to the Free Software
18  // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  // Go to ... http://www.gnu.org/copyleft/lesser.html
20  // 
21  // hitzer@mech.fukui-u.ac.jp
22  // 
23  // Department of Mechanical Engineering, Fukui University
24  // 3-9-1 Bunkyo, 910-8507 Fukui, Japan
25  // 
26  //
27  //
28  // It the personal wish of E.M.S. Hitzer,
29  // that you never use this software for infringing human dignity:
30  //
31  // "God created man in his own image,
32  // in the image of God he created him;
33  // male and female he created them.
34  // [The Bible, Genesis chapter 1 verse 27]
35  //
36  //
37  //
38  // 
39  // File fMV.java
40  // 2003-1-9
41  package net.sourceforge.kamiwaai.geometricalgebra;
42  // A class defining frequently used MultiVectors
43  public class MultiVectors {
44  	private static ComplexNumber czero = ComplexNumber.ZERO;
45  	private static ComplexQuat cqzero = ComplexQuat.ZERO;
46  	private static ComplexQuat cqone = ComplexQuat.ONE;
47  	public MultiVectors() {
48  	}
49  	public static MultiVector n() {
50  		ComplexQuat[] nq = {cqzero, cqone, cqzero, cqzero};
51  		return new MultiVector(nq);
52  	}
53  	public static MultiVector nbar() {
54  		ComplexQuat[] nbarq = {cqzero, cqzero, cqone, cqzero};
55  		return new MultiVector(nbarq);
56  	}
57  	public static MultiVector N() {
58  		// Definition of N = n ^ nbar
59  		ComplexQuat[] nhn = {cqzero, cqzero, cqzero, cqone};
60  		return new MultiVector(nhn);
61  	}
62  	public static MultiVector One() {
63  		ComplexQuat[] one = {cqone, cqzero, cqzero, cqzero};
64  		return new MultiVector(one);
65  	}
66  	public static MultiVector Zero() {
67  		return One().multSc(0.0);
68  	}
69  	public static MultiVector I() {
70  		// Definition of the pseudoscalar I = e0e1e2e3e4
71  		ComplexNumber[] iSc = {new ComplexNumber(0.0, 1.0), czero, czero, czero};
72  		ComplexQuat[] i = {new ComplexQuat(iSc), cqzero, cqzero, cqzero};
73  		return new MultiVector(i);
74  	}
75  	public static MultiVector e1() {
76  		ComplexNumber[] e1Sc = {czero, new ComplexNumber(0.0, -1.0), czero,
77  				czero};
78  		ComplexQuat[] e1cq = {cqzero, cqzero, cqzero, new ComplexQuat(e1Sc)};
79  		return new MultiVector(e1cq);
80  	}
81  	public static MultiVector e2() {
82  		ComplexNumber[] e2Sc = {czero, czero, new ComplexNumber(0.0, -1.0),
83  				czero};
84  		ComplexQuat[] e2cq = {cqzero, cqzero, cqzero, new ComplexQuat(e2Sc)};
85  		return new MultiVector(e2cq);
86  	}
87  	public static MultiVector e3() {
88  		ComplexNumber[] e3Sc = {czero, czero, czero,
89  				new ComplexNumber(0.0, -1.0)};
90  		ComplexQuat[] e3cq = {cqzero, cqzero, cqzero, new ComplexQuat(e3Sc)};
91  		return new MultiVector(e3cq);
92  	}
93  }