Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ private IPhysicsUpdate getUpdater(RigidBody body, IMU base) {
Vector3f oldavelocity = new Vector3f(0f, 0f, 0f);
Vector3f oldvelocity = new Vector3f(0f, 0f, 0f);
Vector3f gravity = new Vector3f();
private Quat4f orentation = new Quat4f();
private Quat4f orientation = new Quat4f();
Transform gravTrans = new Transform();
Transform orentTrans = new Transform();
Transform orientTrans = new Transform();
Vector3f avelocity = new Vector3f();
Vector3f velocity = new Vector3f();

Expand All @@ -65,25 +65,25 @@ public void update(float timeStep) {
body.getLinearVelocity(velocity);

body.getGravity(gravity);
body.getOrientation(orentation);
body.getOrientation(orientation);

TransformFactory.nrToBullet(new TransformNR(gravity.x, gravity.y, gravity.z, new RotationNR()),
gravTrans);
TransformFactory.nrToBullet(
new TransformNR(0, 0, 0, orentation.w, orentation.x, orentation.y, orentation.z), orentTrans);
orentTrans.inverse();
orentTrans.mul(gravTrans);
new TransformNR(0, 0, 0, orientation.w, orientation.x, orientation.y, orientation.z), orientTrans);
orientTrans.inverse();
orientTrans.mul(gravTrans);

// A=DeltaV / DeltaT
Double rotxAcceleration = (double) ((oldavelocity.x - avelocity.x) / timeStep);
Double rotyAcceleration = (double) ((oldavelocity.y - avelocity.y) / timeStep);
Double rotzAcceleration = (double) ((oldavelocity.z - avelocity.z) / timeStep);
Double xAcceleration = (double) (((oldvelocity.x - velocity.x) / timeStep) / PhysicsGravityScalar)
+ (orentTrans.origin.x / PhysicsGravityScalar);
+ (orientTrans.origin.x / PhysicsGravityScalar);
Double yAcceleration = (double) (((oldvelocity.y - velocity.y) / timeStep) / PhysicsGravityScalar)
+ (orentTrans.origin.y / PhysicsGravityScalar);
+ (orientTrans.origin.y / PhysicsGravityScalar);
Double zAcceleration = (double) (((oldvelocity.z - velocity.z) / timeStep) / PhysicsGravityScalar)
+ (orentTrans.origin.z / PhysicsGravityScalar);
+ (orientTrans.origin.z / PhysicsGravityScalar);
// tell the virtual IMU the system updated
base.setVirtualState(new IMUUpdate(xAcceleration, yAcceleration, zAcceleration, rotxAcceleration,
rotyAcceleration, rotzAcceleration, base.currentTimeMillis()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

public class Mirror extends CaDoodleOperation {
@Expose(serialize = true, deserialize = true)
private MirrorOrentation location;
private MirrorOrientation location;
@Expose(serialize = true, deserialize = true)
private List<String> names = new ArrayList<String>();
@Expose(serialize = true, deserialize = true)
Expand Down Expand Up @@ -60,13 +60,13 @@ public List<CSG> process(List<CSG> incoming) {
Transform mirroringCenter = new Transform().movex(base.getCenterX()).movey(base.getCenterY())
.movez(base.getCenterZ());
Transform sc = new Transform();
if (location == MirrorOrentation.x) {
if (location == MirrorOrientation.x) {
sc = new Transform().scaleX(-1);
}
if (location == MirrorOrentation.y) {
if (location == MirrorOrientation.y) {
sc = new Transform().scaleY(-1);
}
if (location == MirrorOrentation.z) {
if (location == MirrorOrientation.z) {
sc = new Transform().scaleZ(-1);
}
Transform scale = sc;
Expand Down Expand Up @@ -116,25 +116,25 @@ private CSG mirror(CSG csg, String name) {
Transform mirroringCenter = new Transform().movex(t.getCenterX()).movex(t.getCenterY()).movez(t.getCenterZ());

CSG centered = t.transformed(mirroringCenter.inverse());
if (location == MirrorOrentation.x) {
if (location == MirrorOrientation.x) {
centered = centered.mirrorx();
}
if (location == MirrorOrentation.y) {
if (location == MirrorOrientation.y) {
centered = centered.mirrory();
}
if (location == MirrorOrentation.z) {
if (location == MirrorOrientation.z) {
centered = centered.mirrorz();
}
centered = centered.transformed(mirroringCenter);
centered = centered.transformed(TransformFactory.nrToCSG(getWorkplane(csg)));
return centered.setName(name).syncProperties(getCaDoodleFile().getCsgDBinstance(), csg);
}

public MirrorOrentation getLocation() {
public MirrorOrientation getLocation() {
return location;
}

public Mirror setLocation(MirrorOrentation location) {
public Mirror setLocation(MirrorOrientation location) {
this.location = location;
return this;
}
Expand Down
Loading