当前位置: 首页>>代码示例>>Java>>正文


Java Vec3类代码示例

本文整理汇总了Java中org.jbox2d.common.Vec3的典型用法代码示例。如果您正苦于以下问题:Java Vec3类的具体用法?Java Vec3怎么用?Java Vec3使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Vec3类属于org.jbox2d.common包,在下文中一共展示了Vec3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: PrismaticJoint

import org.jbox2d.common.Vec3; //导入依赖的package包/类
protected PrismaticJoint(IWorldPool argWorld, PrismaticJointDef def) {
  super(argWorld, def);
  m_localAnchorA = new Vec2(def.localAnchorA);
  m_localAnchorB = new Vec2(def.localAnchorB);
  m_localXAxisA = new Vec2(def.localAxisA);
  m_localXAxisA.normalize();
  m_localYAxisA = new Vec2();
  Vec2.crossToOutUnsafe(1f, m_localXAxisA, m_localYAxisA);
  m_referenceAngle = def.referenceAngle;

  m_impulse = new Vec3();
  m_motorMass = 0.0f;
  m_motorImpulse = 0.0f;

  m_lowerTranslation = def.lowerTranslation;
  m_upperTranslation = def.upperTranslation;
  m_maxMotorForce = def.maxMotorForce;
  m_motorSpeed = def.motorSpeed;
  m_enableLimit = def.enableLimit;
  m_enableMotor = def.enableMotor;
  m_limitState = LimitState.INACTIVE;

  m_K = new Mat33();
  m_axis = new Vec2();
  m_perp = new Vec2();
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:27,代码来源:PrismaticJoint.java

示例2: DefaultWorldPool

import org.jbox2d.common.Vec3; //导入依赖的package包/类
public DefaultWorldPool(int argSize, int argContainerSize) {
  vecs = new OrderedStack<Vec2>(argSize, argContainerSize) {
    protected Vec2 newInstance() { return new Vec2(); }
  };
  vec3s = new OrderedStack<Vec3>(argSize, argContainerSize) {
    protected Vec3 newInstance() { return new Vec3(); }
  };
  mats = new OrderedStack<Mat22>(argSize, argContainerSize) {
    protected Mat22 newInstance() { return new Mat22(); }
  };
  aabbs = new OrderedStack<AABB>(argSize, argContainerSize) {
    protected AABB newInstance() { return new AABB(); }
  };
  rots = new OrderedStack<Rot>(argSize, argContainerSize) {
    protected Rot newInstance() { return new Rot(); }
  };
  mat33s = new OrderedStack<Mat33>(argSize, argContainerSize) {
    protected Mat33 newInstance() { return new Mat33(); }
  };

  dist = new Distance();
  collision = new Collision(this);
  toi = new TimeOfImpact(this);
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:25,代码来源:DefaultWorldPool.java

示例3: PrismaticJoint

import org.jbox2d.common.Vec3; //导入依赖的package包/类
public PrismaticJoint(IWorldPool argWorld, PrismaticJointDef def) {
	super(argWorld, def);
	m_localAnchor1 = new Vec2(def.localAnchorA);
	m_localAnchor2 = new Vec2(def.localAnchorB);
	m_localXAxis1 = new Vec2(def.localAxis1);
	m_localYAxis1 = new Vec2();
	Vec2.crossToOut(1f, m_localXAxis1, m_localYAxis1);
	m_refAngle = def.referenceAngle;
	
	m_impulse = new Vec3();
	m_motorMass = 0.0f;
	m_motorImpulse = 0.0f;
	
	m_lowerTranslation = def.lowerTranslation;
	m_upperTranslation = def.upperTranslation;
	m_maxMotorForce = def.maxMotorForce;
	m_motorSpeed = def.motorSpeed;
	m_enableLimit = def.enableLimit;
	m_enableMotor = def.enableMotor;
	m_limitState = LimitState.INACTIVE;
	
	m_K = new Mat33();
	m_axis = new Vec2();
	m_perp = new Vec2();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:26,代码来源:PrismaticJoint.java

示例4: PrismaticJoint

import org.jbox2d.common.Vec3; //导入依赖的package包/类
public PrismaticJoint(WorldPool argWorld, PrismaticJointDef def) {
	super(argWorld, def);
	m_localAnchor1 = new Vec2(def.localAnchorA);
	m_localAnchor2 = new Vec2(def.localAnchorB);
	m_localXAxis1 = new Vec2(def.localAxis1);
	m_localYAxis1 = new Vec2();
	Vec2.crossToOut(1f, m_localXAxis1, m_localYAxis1);
	m_refAngle = def.referenceAngle;
	
	m_impulse = new Vec3();
	m_motorMass = 0.0f;
	m_motorImpulse = 0.0f;
	
	m_lowerTranslation = def.lowerTranslation;
	m_upperTranslation = def.upperTranslation;
	m_maxMotorForce = def.maxMotorForce;
	m_motorSpeed = def.motorSpeed;
	m_enableLimit = def.enableLimit;
	m_enableMotor = def.enableMotor;
	m_limitState = LimitState.INACTIVE;
	
	m_K = new Mat33();
	m_axis = new Vec2();
	m_perp = new Vec2();
}
 
开发者ID:fredsa,项目名称:forplay,代码行数:26,代码来源:PrismaticJoint.java

示例5: WeldJoint

import org.jbox2d.common.Vec3; //导入依赖的package包/类
protected WeldJoint(IWorldPool argWorld, WeldJointDef def) {
  super(argWorld, def);
  m_localAnchorA = new Vec2(def.localAnchorA);
  m_localAnchorB = new Vec2(def.localAnchorB);
  m_referenceAngle = def.referenceAngle;
  m_frequencyHz = def.frequencyHz;
  m_dampingRatio = def.dampingRatio;

  m_impulse = new Vec3();
  m_impulse.setZero();
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:12,代码来源:WeldJoint.java

示例6: WeldJoint

import org.jbox2d.common.Vec3; //导入依赖的package包/类
/**
 * @param argWorld
 * @param def
 */
protected WeldJoint(IWorldPool argWorld, WeldJointDef def) {
	super(argWorld, def);
	m_localAnchorA = new Vec2(def.localAnchorA);
	m_localAnchorB = new Vec2(def.localAnchorB);
	m_referenceAngle = def.referenceAngle;

	m_impulse = new Vec3();
	m_impulse.setZero();
	
	m_mass = new Mat33();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:16,代码来源:WeldJoint.java

示例7: WorldPool

import org.jbox2d.common.Vec3; //导入依赖的package包/类
public WorldPool(int argSize, int argContainerSize){
	vecs = new OrderedStack<Vec2>(Vec2.class, argSize, argContainerSize);
	vec3s = new OrderedStack<Vec3>(Vec3.class, argSize, argContainerSize);
	mats = new OrderedStack<Mat22>(Mat22.class, argSize, argContainerSize);
	aabbs = new OrderedStack<AABB>(AABB.class, argSize, argContainerSize);
	
	dist = new Distance();
	collision = new Collision(this);
	toi = new TimeOfImpact(this);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:11,代码来源:WorldPool.java

示例8: WeldJoint

import org.jbox2d.common.Vec3; //导入依赖的package包/类
/**
 * @param argWorld
 * @param def
 */
protected WeldJoint(WorldPool argWorld, WeldJointDef def) {
	super(argWorld, def);
	m_localAnchorA = new Vec2(def.localAnchorA);
	m_localAnchorB = new Vec2(def.localAnchorB);
	m_referenceAngle = def.referenceAngle;

	m_impulse = new Vec3();
	m_impulse.setZero();
	
	m_mass = new Mat33();
}
 
开发者ID:fredsa,项目名称:forplay,代码行数:16,代码来源:WeldJoint.java

示例9: PoolingStackVec3

import org.jbox2d.common.Vec3; //导入依赖的package包/类
public PoolingStackVec3(int size) {
  this.size = size;
  this.pool = new Vec3[size];
  this.index = 0;
  this.container = new PoolContainer<Vec3>();
  
  for (int i = 0; i < size; i++) {
    pool[i] = new Vec3();
  }
}
 
开发者ID:fredsa,项目名称:forplay,代码行数:11,代码来源:PoolingStackVec3.java

示例10: pop

import org.jbox2d.common.Vec3; //导入依赖的package包/类
@Override @SuppressWarnings("fallthrough")
public org.jbox2d.pooling.PoolingStack.PoolContainer<Vec3> pop(int argNum) {
  assert(index + argNum < size) : "End of stack reached, there is probably a leak somewhere";
  
  switch (argNum) {
    case 9:
      container.p8 = pool[index++];
    case 8:
      container.p7 = pool[index++];
    case 7:
      container.p6 = pool[index++];
    case 6:
      container.p5 = pool[index++];
    case 5:
      container.p4 = pool[index++];
    case 4:
      container.p3 = pool[index++];
    case 3:
      container.p2 = pool[index++];
    case 2:
      container.p1 = pool[index++];
    case 1:
      container.p0 = pool[index++];
      break;
    default:
      assert(false);
  }
  return container;
}
 
开发者ID:fredsa,项目名称:forplay,代码行数:30,代码来源:PoolingStackVec3.java

示例11: popVec3

import org.jbox2d.common.Vec3; //导入依赖的package包/类
public final PoolContainer<Vec3> popVec3(int argNum){
	if(!Settings.POOLING){
		PoolContainer<Vec3> pc = new PoolContainer<Vec3>();
		Vec3[] ray = new Vec3[PoolContainer.MAX_MEMBERS];
		for(int i=0; i<argNum; i++){
			ray[i] = new Vec3();
		}
		pc.populate(ray);
		return pc;
	}
	return vec3s.pop(argNum);
}
 
开发者ID:fredsa,项目名称:forplay,代码行数:13,代码来源:WorldPool.java

示例12: testMat33

import org.jbox2d.common.Vec3; //导入依赖的package包/类
public void testMat33() {
  Mat33 mat = new Mat33();

  mat.ex.set(3, 19, -5);
  mat.ey.set(-1, 1, 4);
  mat.ez.set(-10, 4, 4);

  Vec3 b = new Vec3(4, 1, 2);
  assertEquals(new Vec3(0.096f, 1.1013334f, -.48133332f), mat.solve33(b));

  Vec2 b2 = new Vec2(4, 1);
  assertEquals(new Vec2(0.22727273f, -3.318182f), mat.solve22(b2));
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:14,代码来源:MathTest.java

示例13: draw

import org.jbox2d.common.Vec3; //导入依赖的package包/类
public void draw(GL10 gl) {
if(!visible) { return; }

// Update local data from physics engine, if applicable
if(body != null) {
    position = Renderer.worldToScreen(body.getPosition());

    if (!fixedRotation) {
        rotation = body.getAngle() * 57.2957795786f;
    }

}
//start defining things to draw

//save current state
gl.glPushMatrix();

gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);

//move to object position
gl.glTranslatef(position.x,position.y,1.0f);

// set angle and rotation
gl.glRotatef(0.0f,1.0f,0.0f,0.0f);
gl.glRotatef(0.0f,0.0f,1.0f,0.0f);
gl.glRotatef(rotation,0.0f,0.0f,1.0f);

//get color convert to 0.0 - 1.0 range
Vec3 renderCol = color.toFloat();
gl.glColor4f(renderCol.x,renderCol.y,renderCol.z,1.0f);

gl.glVertexPointer(3,GL10.GL_FLOAT,0,vertBuffer);
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, vertices.length / 3);

gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
gl.glPopMatrix();

  }
 
开发者ID:fokkedekker,项目名称:Eindproject,代码行数:40,代码来源:BaseObject.java

示例14: popVec3

import org.jbox2d.common.Vec3; //导入依赖的package包/类
public Vec3 popVec3()
{
	if (!Settings.POOLING)
	{
		return new Vec3();
	}
	return vec3s.pop();
}
 
开发者ID:dragome,项目名称:dragome-examples,代码行数:9,代码来源:WorldPool.java

示例15: DefaultWorldPool

import org.jbox2d.common.Vec3; //导入依赖的package包/类
public DefaultWorldPool(int argSize, int argContainerSize) {
  vecs = new OrderedStack<Vec2>(Vec2.class, argSize, argContainerSize);
  vec3s = new OrderedStack<Vec3>(Vec3.class, argSize, argContainerSize);
  mats = new OrderedStack<Mat22>(Mat22.class, argSize, argContainerSize);
  aabbs = new OrderedStack<AABB>(AABB.class, argSize, argContainerSize);

  dist = new Distance();
  collision = new Collision(this);
  toi = new TimeOfImpact(this);
}
 
开发者ID:col726,项目名称:game-engine-CMZ,代码行数:11,代码来源:DefaultWorldPool.java


注:本文中的org.jbox2d.common.Vec3类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。