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
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 static void main(String[] args){
@ -7,5 +7,7 @@ public class Application {
System.out.println(dual);
Quaternion quaternion = new Quaternion(21, 45, 7, -9);
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{
private double r;

View file

@ -1,4 +1,4 @@
package fr.alnotz;
package fr.alnotz.quaternion;
public class DualQuaternion implements IsDualQuaternion {
private double rs;
@ -254,9 +254,8 @@ public class DualQuaternion implements IsDualQuaternion {
this.ri * dualQuaternion.getDJ() + this.di * dualQuaternion.getRJ() -
this.rj * dualQuaternion.getDI() - this.dj * dualQuaternion.getRI() +
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);
return newDQ;
}
@Override
@ -270,4 +269,9 @@ public class DualQuaternion implements IsDualQuaternion {
this.dj == dualQuaternion.getDJ() &&
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 {
double getR();

View file

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

View file

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

View file

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