darwin.util.math.container.SimplePhysic Maven / Gradle / Ivy
/*
* Copyright (C) 2012 daniel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a clone of the GNU General Public License
* along with this program. If not, see .
*/
package darwin.util.math.container;
import darwin.util.math.base.vector.*;
/**
*
* @author dheinrich
*/
public class SimplePhysic extends SimpleTransformation implements PhysicContainer{
private final float radius, mass;
private ImmutableVector vel;
public SimplePhysic(float radius, float mass) {
this(radius, mass, new Vector3());
}
public SimplePhysic(float radius, float mass, ImmutableVector v) {
this.radius = radius;
this.mass = mass;
vel = v.clone();
}
@Override
public ImmutableVector getVelocity() {
return vel;
}
@Override
public void setVelocity(ImmutableVector newvel) {
vel = newvel.clone();
}
@Override
public float getRadius() {
return radius;
}
@Override
public float getMass() {
return mass;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy