use of maspack.util.InternalErrorException in project artisynth_core by artisynth.
the class MatrixNdBlock method clone.
/**
* Creates a clone of this matrix block, with the link and offset information
* set to be undefined.
*/
public MatrixNdBlock clone() {
MatrixNdBlock blk;
try {
blk = (MatrixNdBlock) super.clone();
} catch (CloneNotSupportedException e) {
// shouldn't happen
throw new InternalErrorException("clone failed for " + getClass());
}
blk.initBlockVariables();
return blk;
}
use of maspack.util.InternalErrorException in project artisynth_core by artisynth.
the class LemkeContactSolver method Melem.
private double Melem(int i, int j) {
ContactVariable wvar = wVars[i];
ContactVariable zvar = zVars[j];
if (zvar.type == Z0) {
return c[wvar.idx];
} else if (wvar.nd != null && zvar.nd != null) {
return wvar.nd.dot(zvar.nd);
} else if (zvar.type == LAMBDA) {
if (wvar.type == SIGMA && wvar.ci == zvar.ci) {
return 1;
} else {
return 0;
}
} else if (wvar.type == GAMMA) {
if (zvar.type == THETA && wvar.ci == zvar.ci) {
return contactInfo[zvar.ci].mu;
} else if (zvar.type == PHI && wvar.ci == zvar.ci) {
return -1;
} else {
return 0;
}
} else {
throw new InternalErrorException("unknown element at i=" + i + ", j=" + j);
}
}
use of maspack.util.InternalErrorException in project artisynth_core by artisynth.
the class LemkeSolverBase method growObjectArray.
protected Object growObjectArray(Object oldArray, int length, Class classType) {
int oldLength = Array.getLength(oldArray);
Object newArray = Array.newInstance(classType, length);
for (int i = 0; i < oldLength; i++) {
Array.set(newArray, i, Array.get(oldArray, i));
}
for (int i = oldLength; i < length; i++) {
try {
Array.set(newArray, i, classType.newInstance());
} catch (Exception e) {
throw new InternalErrorException("Can't grow object array: " + e.getMessage());
}
}
return newArray;
}
use of maspack.util.InternalErrorException in project artisynth_core by artisynth.
the class TextureMapProps method clone.
public TextureMapProps clone() {
TextureMapProps props = null;
try {
props = (TextureMapProps) super.clone();
} catch (CloneNotSupportedException e) {
throw new InternalErrorException("Cannot clone super in TextureProps");
}
set(props);
return props;
}
use of maspack.util.InternalErrorException in project artisynth_core by artisynth.
the class Transrotator3d method intersectRayAndFixture.
protected void intersectRayAndFixture(Point3d p, Line ray) {
Line draggerRay = new Line(ray);
draggerRay.inverseTransform(myXDraggerToWorld);
switch(mySelectedComponent) {
case X_AXIS:
{
xAxis.nearestPoint(p, draggerRay);
p.y = p.z = 0;
break;
}
case Y_AXIS:
{
yAxis.nearestPoint(p, draggerRay);
p.x = p.z = 0;
break;
}
case Z_AXIS:
{
zAxis.nearestPoint(p, draggerRay);
p.x = p.y = 0;
break;
}
case XY_PLANE:
{
draggerRay.intersectPlane(p, xyPlane);
p.z = 0;
break;
}
case YZ_PLANE:
{
draggerRay.intersectPlane(p, yzPlane);
p.x = 0;
break;
}
case ZX_PLANE:
{
draggerRay.intersectPlane(p, zxPlane);
p.y = 0;
break;
}
default:
{
throw new InternalErrorException("unexpected case " + mySelectedComponent);
}
}
}
Aggregations