javax.vecmath.Point3f Java Examples

The following examples show how to use javax.vecmath.Point3f. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Java3DWindow.java    From GpsPrune with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a text object for compass point, N S E or W
 * @param inText text to display
 * @param inLocn position at which to display
 * @param inFont 3d font to use
 * @return compound object
 */
private TransformGroup createCompassPoint(String inText, Point3f inLocn, Font3D inFont)
{
	Text3D txt = new Text3D(inFont, inText, inLocn, Text3D.ALIGN_FIRST, Text3D.PATH_RIGHT);
	Material mat = new Material(new Color3f(0.5f, 0.5f, 0.55f),
		new Color3f(0.05f, 0.05f, 0.1f), new Color3f(0.3f, 0.4f, 0.5f),
		new Color3f(0.4f, 0.5f, 0.7f), 70.0f);
	mat.setLightingEnable(true);
	Appearance app = new Appearance();
	app.setMaterial(mat);
	Shape3D shape = new Shape3D(txt, app);

	// Make transform group with billboard behaviour
	TransformGroup subGroup = new TransformGroup();
	subGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
	subGroup.addChild(shape);
	Billboard billboard = new Billboard(subGroup, Billboard.ROTATE_ABOUT_POINT, inLocn);
	BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);
	billboard.setSchedulingBounds(bounds);
	subGroup.addChild(billboard);
	return subGroup;
}
 
Example #2
Source File: VMDMotion.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public final void readFromStream(DataInputStreamLittleEndian is) throws IOException {
        boneName = is.readString(15);
        boneIndex = -1;
//        for(int i=0;i<vmdFile.boneNames.size();i++) {
//            if (boneName.equals(vmdFile.boneNames.get(i))) {
//                boneIndex = (short)i;
//                break;
//            }
//        }
        boneIndex = (short)vmdFile.boneNames.indexOf(boneName);
        if (boneIndex < 0) {
            vmdFile.boneNames.add(boneName);
//            boneIndex = (short)(vmdFile.boneNames.size() - 1);
            boneIndex = (short)vmdFile.boneNames.indexOf(boneName);
        }
        frameNo = is.readInt();
        location = new Point3f();
        location.x = is.readFloat();
        location.y = is.readFloat();
        location.z = -is.readFloat();
        rotation = new Quat4f(is.readFloat(), is.readFloat(), -is.readFloat(), -is.readFloat());
        int pos = 0;
        while(pos < 64) {
            pos += is.read(interpolation, pos, 64 - pos);
        }
    }
 
Example #3
Source File: ColumnarStructureX.java    From mmtf-spark with Apache License 2.0 5 votes vote down vote up
public Point3f[] getcAlphaCoordinatesF() {
    List<Integer> indices = getCalphaAtomIndices();

    float[] x = getxCoords();
    float[] y = getyCoords();
    float[] z = getzCoords();

    Point3f[] calpha = new Point3f[indices.size()];
    for (int i = 0; i < calpha.length; i++) {
        int index = indices.get(i);
        calpha[i] = new Point3f(x[index], y[index], z[index]);
    }
    return calpha;
}
 
Example #4
Source File: GltfViewerPanel.java    From JglTF with MIT License 5 votes vote down vote up
/**
 * Reset the external camera to its initial configuration
 */
private void resetExternalCamera()
{
    de.javagl.rendering.core.view.Camera camera = 
        externalCamera.getCamera();
    camera.setEyePoint(new Point3f(0, 0, 1));
    camera.setViewPoint(new Point3f(0, 0, 0)); 
    camera.setUpVector(new Vector3f(0, 1, 0));
    camera.setFovDegY(60.0f);            
}
 
Example #5
Source File: Axis.java    From javagame with MIT License 5 votes vote down vote up
public Axis() {
    axisBG = new BranchGroup();

    // Geometry�̐���
    LineArray axisX = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
    LineArray axisY = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
    LineArray axisZ = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);

    // ���_�̃Z�b�g
    Color3f red = new Color3f(1.0f, 0.0f, 0.0f);
    Color3f green = new Color3f(0.0f, 1.0f, 0.0f);
    Color3f blue = new Color3f(0.0f, 0.0f, 1.0f);

    axisX.setCoordinate(0, new Point3f(-1.0f, 0.0f, 0.0f));
    axisX.setCoordinate(1, new Point3f(1.0f, 0.0f, 0.0f));
    axisX.setColor(0, red);
    axisX.setColor(1, red);

    axisY.setCoordinate(0, new Point3f(0.0f, -1.0f, 0.0f));
    axisY.setCoordinate(1, new Point3f(0.0f, 1.0f, 0.0f));
    axisY.setColor(0, green);
    axisY.setColor(1, green);

    axisZ.setCoordinate(0, new Point3f(0.0f, 0.0f, -1.0f));
    axisZ.setCoordinate(1, new Point3f(0.0f, 0.0f, 1.0f));
    axisZ.setColor(0, blue);
    axisZ.setColor(1, blue);

    // BG�ɒlj�
    axisBG.addChild(new Shape3D(axisX));
    axisBG.addChild(new Shape3D(axisY));
    axisBG.addChild(new Shape3D(axisZ));
}
 
Example #6
Source File: Axis.java    From javagame with MIT License 5 votes vote down vote up
public Axis() {
    axisBG = new BranchGroup();

    // Geometry�̐���
    LineArray axisX = new LineArray(2, LineArray.COORDINATES
            | LineArray.COLOR_3);
    LineArray axisY = new LineArray(2, LineArray.COORDINATES
            | LineArray.COLOR_3);
    LineArray axisZ = new LineArray(2, LineArray.COORDINATES
            | LineArray.COLOR_3);

    // ���_�̃Z�b�g
    Color3f red = new Color3f(1.0f, 0.0f, 0.0f);
    Color3f green = new Color3f(0.0f, 1.0f, 0.0f);
    Color3f blue = new Color3f(0.0f, 0.0f, 1.0f);

    axisX.setCoordinate(0, new Point3f(-10.0f, 0.0f, 0.0f));
    axisX.setCoordinate(1, new Point3f(10.0f, 0.0f, 0.0f));
    axisX.setColor(0, red);
    axisX.setColor(1, red);

    axisY.setCoordinate(0, new Point3f(0.0f, -10.0f, 0.0f));
    axisY.setCoordinate(1, new Point3f(0.0f, 10.0f, 0.0f));
    axisY.setColor(0, green);
    axisY.setColor(1, green);

    axisZ.setCoordinate(0, new Point3f(0.0f, 0.0f, -10.0f));
    axisZ.setCoordinate(1, new Point3f(0.0f, 0.0f, 10.0f));
    axisZ.setColor(0, blue);
    axisZ.setColor(1, blue);

    // axisBG�ɒlj�
    axisBG.addChild(new Shape3D(axisX));
    axisBG.addChild(new Shape3D(axisY));
    axisBG.addChild(new Shape3D(axisZ));
}
 
Example #7
Source File: Triforce.java    From javagame with MIT License 4 votes vote down vote up
public Triforce() {
    triforceBG = new BranchGroup();

    // Geometry�̐���
    TriangleArray t1 = new TriangleArray(3, TriangleArray.COORDINATES
            | TriangleArray.COLOR_3);
    TriangleArray t2 = new TriangleArray(3, TriangleArray.COORDINATES
            | TriangleArray.COLOR_3);
    TriangleArray t3 = new TriangleArray(3, TriangleArray.COORDINATES
            | TriangleArray.COLOR_3);

    // ���_�̃Z�b�g
    Color3f yellow = new Color3f(1.0f, 1.0f, 0.0f); // �g���C�t�H�[�X�̐F

    // ��̎O�p�`
    t1.setCoordinate(0, new Point3f(0.0f, 0.6f, 0.0f));
    t1.setCoordinate(1, new Point3f(-0.3f, 0.0f, 0.0f));
    t1.setCoordinate(2, new Point3f(0.3f, 0.0f, 0.0f));
    t1.setColor(0, yellow);
    t1.setColor(1, yellow);
    t1.setColor(2, yellow);

    // �����̎O�p�`
    t2.setCoordinate(0, new Point3f(-0.3f, 0.0f, 0.0f));
    t2.setCoordinate(1, new Point3f(-0.6f, -0.6f, 0.0f));
    t2.setCoordinate(2, new Point3f(0.0f, -0.6f, 0.0f));
    t2.setColor(0, yellow);
    t2.setColor(1, yellow);
    t2.setColor(2, yellow);

    // �E���̎O�p�`
    t3.setCoordinate(0, new Point3f(0.3f, 0.0f, 0.0f));
    t3.setCoordinate(1, new Point3f(0.0f, -0.6f, 0.0f));
    t3.setCoordinate(2, new Point3f(0.6f, -0.6f, 0.0f));
    t3.setColor(0, yellow);
    t3.setColor(1, yellow);
    t3.setColor(2, yellow);

    // Appearance�̐ݒ�
    Appearance app = new Appearance();

    PolygonAttributes pAttr = new PolygonAttributes();
    pAttr.setCullFace(PolygonAttributes.CULL_NONE); // ���ʂ��`��

    app.setPolygonAttributes(pAttr);

    // BG�ɒlj�
    triforceBG.addChild(new Shape3D(t1, app));
    triforceBG.addChild(new Shape3D(t2, app));
    triforceBG.addChild(new Shape3D(t3, app));
}
 
Example #8
Source File: Main3D.java    From javagame with MIT License 4 votes vote down vote up
/**
 * �V�[�����\�z����
 * 
 * @return BG
 */
public BranchGroup createSceneGraph() {
    BranchGroup bg = new BranchGroup();

    // ������3D�I�u�W�F�N�g��lj�

    // ���W����lj�
    Axis axis = new Axis();
    bg.addChild(axis.getBG());

    // �_��lj�
    Point3f[] vertices = { // �_�̍��W
            new Point3f(-0.5f, 0.5f, -0.5f),
            new Point3f(0.5f, 0.5f, -0.5f),
            new Point3f(0.5f, 0.5f, 0.5f),
            new Point3f(-0.5f, 0.5f, 0.5f),
            new Point3f(-0.5f, -0.5f, -0.5f),
            new Point3f(0.5f, -0.5f, -0.5f),
            new Point3f(0.5f, -0.5f, 0.5f),
            new Point3f(-0.5f, -0.5f, 0.5f)
    };

    Color3f[] colors = { // �_�̐F
            new Color3f(1.0f, 1.0f, 0.0f),
            new Color3f(1.0f, 1.0f, 0.0f),
            new Color3f(1.0f, 1.0f, 0.0f),
            new Color3f(1.0f, 1.0f, 0.0f),
            new Color3f(1.0f, 1.0f, 0.0f),
            new Color3f(1.0f, 1.0f, 0.0f),
            new Color3f(1.0f, 1.0f, 0.0f),
            new Color3f(1.0f, 1.0f, 0.0f)
    };

    // Geometry
    PointArray geo = new PointArray(8, PointArray.COORDINATES
            | PointArray.COLOR_3);
    geo.setCoordinates(0, vertices); // ���_���W���Z�b�g
    geo.setColors(0, colors); // �F���Z�b�g

    // Appearance
    Appearance app = new Appearance();
    PointAttributes attr = new PointAttributes(5.0f, false); // �_�̑傫��
    app.setPointAttributes(attr);

    bg.addChild(new Shape3D(geo, app));

    // �����܂�

    return bg;
}
 
Example #9
Source File: BufferUtil.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static Point3f readPoint3f(ByteBuffer bb, Point3f p) {
    p.x = bb.getFloat();
    p.y = bb.getFloat();
    p.z = bb.getFloat();
    return p;
}
 
Example #10
Source File: BufferUtil.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static void writePoint3f(ByteBuffer bb, Point3f p) {
    bb.putFloat(p.x);
    bb.putFloat(p.y);
    bb.putFloat(p.z);
}
 
Example #11
Source File: VMDMotion.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public VMDMotion() {
    location = new Point3f();
    rotation = new Quat4f();
}
 
Example #12
Source File: VMDMotion.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public Point3f getLocation() {
    return location;
}
 
Example #13
Source File: VMDMotion.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void setLocation(Point3f location) {
    this.location = location;
}