Search in sources :

Example 11 with InternalErrorException

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;
}
Also used : InternalErrorException(maspack.util.InternalErrorException)

Example 12 with InternalErrorException

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);
    }
}
Also used : InternalErrorException(maspack.util.InternalErrorException)

Example 13 with InternalErrorException

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;
}
Also used : InternalErrorException(maspack.util.InternalErrorException) InternalErrorException(maspack.util.InternalErrorException)

Example 14 with InternalErrorException

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;
}
Also used : InternalErrorException(maspack.util.InternalErrorException)

Example 15 with InternalErrorException

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);
            }
    }
}
Also used : Line(maspack.matrix.Line) InternalErrorException(maspack.util.InternalErrorException)

Aggregations

InternalErrorException (maspack.util.InternalErrorException)92 Vector3d (maspack.matrix.Vector3d)9 CompositeProperty (maspack.properties.CompositeProperty)8 Point3d (maspack.matrix.Point3d)7 Property (maspack.properties.Property)7 FemModel3d (artisynth.core.femmodels.FemModel3d)6 Point (artisynth.core.mechmodels.Point)6 ModelComponent (artisynth.core.modelbase.ModelComponent)5 PolygonalMesh (maspack.geometry.PolygonalMesh)5 Line (maspack.matrix.Line)5 RigidTransform3d (maspack.matrix.RigidTransform3d)5 EditingProperty (maspack.properties.EditingProperty)5 BadLocationException (javax.swing.text.BadLocationException)4 RotationMatrix3d (maspack.matrix.RotationMatrix3d)4 RigidBody (artisynth.core.mechmodels.RigidBody)3 RootModel (artisynth.core.workspace.RootModel)3 File (java.io.File)3 IOException (java.io.IOException)3 LinkedList (java.util.LinkedList)3 SelectionManager (artisynth.core.gui.selectionManager.SelectionManager)2