コード例 #1
0
//--------------------------------------------------------------
ofMatrix4x4 Path3D::zOut(ofMatrix4x4 originalMat){
    
    ofVec3f pos  = originalMat.getTranslation();
    ofVec3f x = originalMat.getRowAsVec3f(0);   // local x-axis
    
    originalMat.setTranslation(0,0,0);
    originalMat.rotate(-90, x.x, x.y, x.z);      // rotate about the y
    originalMat.setTranslation(pos);
    
    return originalMat;
}
コード例 #2
0
//--------------------------------------------------------------
ofMatrix4x4 Path3D::zForward(ofMatrix4x4 originalMat){
    
    ofVec3f pos  = originalMat.getTranslation();
    ofVec3f y = originalMat.getRowAsVec3f(1);   // local y-axis
    
    originalMat.setTranslation(0,0,0);
    originalMat.rotate(90, y.x, y.y, y.z);     // rotate about the y
    originalMat.setTranslation(pos);
    
    return originalMat;
}
コード例 #3
0
//--------------------------------------------------------------
ofMatrix4x4 Path3D::flip(ofMatrix4x4 originalMat){
    
    ofVec3f pos  = originalMat.getTranslation();
    ofVec3f z = originalMat.getRowAsVec3f(2);   // local y-axis
    
    originalMat.setTranslation(0,0,0);
    originalMat.rotate(180, z.x, z.y, z.z);     // rotate about the y
    originalMat.setTranslation(pos);
    
    return originalMat;
}
コード例 #4
0
ramPyramidPrimitive::ramPyramidPrimitive(const ofMatrix4x4& mat, float size)
{
	size *= 0.5;

	mesh.addVertex(ofVec3f(1, 1, 1) * size);
	mesh.addVertex(ofVec3f(-1, 1, -1) * size);
	mesh.addVertex(ofVec3f(-1, -1, 1) * size);
	mesh.addVertex(ofVec3f(1, -1, -1) * size);

	mesh.addTriangle(0, 1, 2);
	mesh.addTriangle(0, 2, 3);
	mesh.addTriangle(0, 3, 1);
	mesh.addTriangle(3, 2, 1);

	body = getWorld().addMesh(mesh, mat.getTranslation(), mat.getRotate().getEuler());
}
コード例 #5
0
ramBoxPrimitive::ramBoxPrimitive(const ofMatrix4x4& mat, const ofVec3f& size)
{
	body = getWorld().addBox(size, mat.getTranslation(), mat.getRotate().getEuler());
}
コード例 #6
0
ramCylinderPrimitive::ramCylinderPrimitive(const ofMatrix4x4& mat, float radius, float height)
{
	body = getWorld().addCylinder(radius, height * 0.5, mat.getTranslation(), mat.getRotate().getEuler());
}