Search in sources :

Example 16 with Coordinate

use of org.vcell.util.Coordinate in project vcell by virtualcell.

the class RasterExporter method calcNAHelper.

private static NAHelper calcNAHelper(Quadrilateral quad) {
    double cx = 0, cy = 0, cz = 0;
    boolean nx = true, ny = true, nz = true;
    double ulp = Math.ulp(quad.getNodes(0).getX()) * 10;
    for (int vrt = 0; vrt < quad.getNodeCount(); vrt++) {
        cx += quad.getNodes(vrt).getX();
        cy += quad.getNodes(vrt).getY();
        cz += quad.getNodes(vrt).getZ();
        double xd = Math.abs(quad.getNodes(0).getX() - quad.getNodes(vrt).getX());
        double yd = Math.abs(quad.getNodes(0).getY() - quad.getNodes(vrt).getY());
        double zd = Math.abs(quad.getNodes(0).getZ() - quad.getNodes(vrt).getZ());
        nx = nx && (xd < ulp);
        ny = ny && (yd < ulp);
        nz = nz && (zd < ulp);
    }
    Coordinate cm = new Coordinate(cx / quad.getNodeCount(), cy / quad.getNodeCount(), cz / quad.getNodeCount());
    int normalAxis = (nx ? Coordinate.X_AXIS : (ny ? Coordinate.Y_AXIS : Coordinate.Z_AXIS));
    return new NAHelper(cm, normalAxis);
}
Also used : Coordinate(org.vcell.util.Coordinate) Point(java.awt.Point)

Example 17 with Coordinate

use of org.vcell.util.Coordinate in project vcell by virtualcell.

the class AnalyticCurve method clone.

/**
 * Insert the method's description here.
 * Creation date: (8/8/00 3:45:00 PM)
 * @return java.lang.Object
 */
public Object clone() {
    AnalyticCurve ac = (AnalyticCurve) super.clone();
    ac.expX = expX;
    ac.expY = expY;
    ac.expZ = expZ;
    ac.offset = new Coordinate(offset.getX(), offset.getY(), offset.getZ());
    return ac;
}
Also used : Coordinate(org.vcell.util.Coordinate)

Example 18 with Coordinate

use of org.vcell.util.Coordinate in project vcell by virtualcell.

the class ControlPointCurve method addOffsetControlPointPrivate.

/**
 * Insert the method's description here.
 * Creation date: (7/18/00 5:38:25 PM)
 * @param offset cbit.vcell.geometry.Coordinate
 */
private void addOffsetControlPointPrivate(Coordinate offset, int controlPointIndex) {
    Coordinate oldCoordinate = controlPoints.elementAt(controlPointIndex);
    Coordinate newCoordinate = new Coordinate(oldCoordinate.getX() + offset.getX(), oldCoordinate.getY() + offset.getY(), oldCoordinate.getZ() + offset.getZ());
    controlPoints.set(controlPointIndex, newCoordinate);
}
Also used : Coordinate(org.vcell.util.Coordinate)

Example 19 with Coordinate

use of org.vcell.util.Coordinate in project vcell by virtualcell.

the class ControlPointCurve method pickControlPoint.

/**
 * Insert the method's description here.
 * Creation date: (7/18/00 4:08:13 PM)
 * @return int
 * @param point java.awt.Point
 */
public int pickControlPoint(Coordinate pickPoint, double minPickDistance) {
    double shortestDistance = Double.MAX_VALUE;
    int controlPointIndex = Curve.NONE_SELECTED;
    int controlPointCount = getControlPointCount();
    for (int i = 0; i < controlPointCount; i++) {
        Coordinate controlPointCoord = controlPoints.elementAt(i);
        double distance = pickPoint.distanceTo(controlPointCoord);
        if (distance <= minPickDistance && distance < shortestDistance) {
            controlPointIndex = i;
            shortestDistance = distance;
        }
    }
    return controlPointIndex;
}
Also used : Coordinate(org.vcell.util.Coordinate)

Example 20 with Coordinate

use of org.vcell.util.Coordinate in project vcell by virtualcell.

the class Curve method getAngle.

/*
{
	if (sampledCurve == null) {
		int sampling = getNumSamplePoints();
		if (sampling == DEFAULT_NUM_SAMPLES_FLAG) {
			sampling = getDefaultNumSamples();
		}
		sampledCurve = new SampledCurve(this, sampling);
	}
	return sampledCurve;
}
*/
/**
 * Insert the method's description here.
 * Creation date: (7/20/00 1:09:20 PM)
 * @return double
 * @param vertex cbit.vcell.geometry.Coordinate
 * @param p1 cbit.vcell.geometry.Coordinate
 * @param p2 cbit.vcell.geometry.Coordinate
 */
public static final double getAngle(Coordinate vertex, Coordinate p1, Coordinate p2) {
    // Vector vertex->p1
    Coordinate v1 = new Coordinate(p1.getX() - vertex.getX(), p1.getY() - vertex.getY(), p1.getZ() - vertex.getZ());
    // Length v1
    double v1Length = Math.sqrt(v1.getX() * v1.getX() + v1.getY() * v1.getY() + v1.getZ() * v1.getZ());
    // Vector vertex->p2
    Coordinate v2 = new Coordinate(p2.getX() - vertex.getX(), p2.getY() - vertex.getY(), p2.getZ() - vertex.getZ());
    // Length v2
    double v2Length = Math.sqrt(v2.getX() * v2.getX() + v2.getY() * v2.getY() + v2.getZ() * v2.getZ());
    // Dot Product v1 and v2
    double dotP = (v1.getX() * v2.getX()) + (v1.getY() * v2.getY()) + (v1.getZ() * v2.getZ());
    // positive Angle 0->PI
    double angle = Math.acos(dotP / (v1Length * v2Length));
    // Angle in degrees
    return angle * 180 / Math.PI;
}
Also used : Coordinate(org.vcell.util.Coordinate)

Aggregations

Coordinate (org.vcell.util.Coordinate)81 CoordinateIndex (org.vcell.util.CoordinateIndex)16 SampledCurve (cbit.vcell.geometry.SampledCurve)11 SinglePoint (cbit.vcell.geometry.SinglePoint)11 ControlPointCurve (cbit.vcell.geometry.ControlPointCurve)10 CurveSelectionInfo (cbit.vcell.geometry.CurveSelectionInfo)6 Expression (cbit.vcell.parser.Expression)6 CartesianMesh (cbit.vcell.solvers.CartesianMesh)6 Vector (java.util.Vector)6 Extent (org.vcell.util.Extent)6 VariableType (cbit.vcell.math.VariableType)5 ISize (org.vcell.util.ISize)5 AnalyticSubVolume (cbit.vcell.geometry.AnalyticSubVolume)4 Curve (cbit.vcell.geometry.Curve)4 SubVolume (cbit.vcell.geometry.SubVolume)4 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 Origin (org.vcell.util.Origin)4 VCImageUncompressed (cbit.image.VCImageUncompressed)3 Line (cbit.vcell.geometry.Line)3