package updated

This commit is contained in:
F. Y. H. 2023-05-23 09:34:07 +02:00
parent 405dc0096a
commit 7ca0e4c33a
Signed by: Alnotz
GPG key ID: B808CA1113935C00
8 changed files with 17 additions and 10 deletions

View file

@ -1,3 +1,3 @@
Manifest-Version: 1.0 Manifest-Version: 1.0
Main-Class: fr.alnotz.Application Main-Class: fr.alnotz.quaternion.Application

View file

@ -1,4 +1,4 @@
package fr.alnotz; package fr.alnotz.quaternion;
public class Application { public class Application {
public static void main(String[] args){ public static void main(String[] args){
@ -7,5 +7,7 @@ public class Application {
System.out.println(dual); System.out.println(dual);
Quaternion quaternion = new Quaternion(21, 45, 7, -9); Quaternion quaternion = new Quaternion(21, 45, 7, -9);
System.out.println(quaternion); System.out.println(quaternion);
DualQuaternion dualQuaternion = new DualQuaternion(quaternion, quaternion.conjugate());
System.out.println(dualQuaternion);
} }
} }

View file

@ -1,4 +1,4 @@
package fr.alnotz; package fr.alnotz.quaternion;
public class Dual implements IsDual{ public class Dual implements IsDual{
private double r; private double r;

View file

@ -1,4 +1,4 @@
package fr.alnotz; package fr.alnotz.quaternion;
public class DualQuaternion implements IsDualQuaternion { public class DualQuaternion implements IsDualQuaternion {
private double rs; private double rs;
@ -254,9 +254,8 @@ public class DualQuaternion implements IsDualQuaternion {
this.ri * dualQuaternion.getDJ() + this.di * dualQuaternion.getRJ() - this.ri * dualQuaternion.getDJ() + this.di * dualQuaternion.getRJ() -
this.rj * dualQuaternion.getDI() - this.dj * dualQuaternion.getRI() + this.rj * dualQuaternion.getDI() - this.dj * dualQuaternion.getRI() +
this.rk * dualQuaternion.getDS() + this.dk * dualQuaternion.getRS(); this.rk * dualQuaternion.getDS() + this.dk * dualQuaternion.getRS();
IsDualQuaternion newDQ = new DualQuaternion(newRS, newRI, newRJ, newRK, return new DualQuaternion(newRS, newRI, newRJ, newRK,
newDS, newDI, newDJ, newDK); newDS, newDI, newDJ, newDK);
return newDQ;
} }
@Override @Override
@ -270,4 +269,9 @@ public class DualQuaternion implements IsDualQuaternion {
this.dj == dualQuaternion.getDJ() && this.dj == dualQuaternion.getDJ() &&
this.dk == dualQuaternion.getDK(); this.dk == dualQuaternion.getDK();
} }
public String toString(){
return String.format("%+f %+fi %+fj %+fk %+fε %+fiε %+fjε %+fkε\n",
this.rs, this.ri, this.rj, this.rk,
this.ds, this.di, this.dj, this.dk);
}
} }

View file

@ -1,4 +1,4 @@
package fr.alnotz; package fr.alnotz.quaternion;
public interface IsDual { public interface IsDual {
double getR(); double getR();

View file

@ -1,4 +1,4 @@
package fr.alnotz; package fr.alnotz.quaternion;
public interface IsDualQuaternion { public interface IsDualQuaternion {
IsQuaternion getR(); IsQuaternion getR();
@ -32,4 +32,5 @@ public interface IsDualQuaternion {
IsDualQuaternion plus(IsDualQuaternion dualQuaternion); IsDualQuaternion plus(IsDualQuaternion dualQuaternion);
IsDualQuaternion times(IsDualQuaternion dualQuaternion); IsDualQuaternion times(IsDualQuaternion dualQuaternion);
boolean equals(IsDualQuaternion dualQuaternion); boolean equals(IsDualQuaternion dualQuaternion);
String toString();
} }

View file

@ -1,4 +1,4 @@
package fr.alnotz; package fr.alnotz.quaternion;
public interface IsQuaternion { public interface IsQuaternion {
double getS(); double getS();

View file

@ -1,4 +1,4 @@
package fr.alnotz; package fr.alnotz.quaternion;
public class Quaternion implements IsQuaternion{ public class Quaternion implements IsQuaternion{
private double s; private double s;