rad.setAll(radius, radius, radius); test_against_min = Vector3.subtractAndCreate(bs_position, rad); test_against_max = Vector3.addAndCreate(bs_position, rad); } else { RajLog.e("[" + this.getClass().getName() + "] Received a bounding box of unknown type.");
Vector3 pos = Vector3.addAndCreate(joint.getPosition(), rotPos); pos.multiply(weight.weightValue); position.add(pos);
@Test public void testAddAndCreate() { final Vector3 u = new Vector3(1d, 2d, 3d); final Vector3 v = new Vector3(0.1d, 0.2d, 0.3d); final Vector3 t = Vector3.addAndCreate(u, v); assertNotNull(t); assertEquals(1.1d, t.x, 0); assertEquals(2.2d, t.y, 0); assertEquals(3.3d, t.z, 0); }
private void buildFrameSkeleton(float[] frameData, Skeleton skeleton) { for(int i=0; i<mNumJoints; ++i) { SkeletonJoint joint = new SkeletonJoint(mBaseFrame[i]); SkeletonJoint jointInfo = mJoints[i]; joint.setParentIndex(jointInfo.getParentIndex()); int j = 0; int startIndex = jointInfo.getStartIndex(); if((jointInfo.getFlags() & 1) == 1) joint.getPosition().x = frameData[startIndex + j++]; if((jointInfo.getFlags() & 2) == 2) joint.getPosition().z = frameData[startIndex + j++]; if((jointInfo.getFlags() & 4) == 4) joint.getPosition().y = frameData[startIndex + j++]; if((jointInfo.getFlags() & 8) == 8) joint.getOrientation().x = frameData[startIndex + j++]; if((jointInfo.getFlags() & 16) == 16) joint.getOrientation().z = frameData[startIndex + j++]; if((jointInfo.getFlags() & 32) == 32) joint.getOrientation().y = frameData[startIndex + j++]; joint.getOrientation().computeW(); if (joint.getParentIndex() >= 0 ) // Has a parent joint { SkeletonJoint parentJoint = skeleton.getJoint(joint.getParentIndex()); Vector3 rotPos = parentJoint.getOrientation().multiply(joint.getPosition()); //We don't clone here because nothing will be able to use the quaternion scratch before we do joint.getPosition().setAll(Vector3.addAndCreate(parentJoint.getPosition(), rotPos)); joint.getOrientation().multiply(parentJoint.getOrientation()); joint.getOrientation().normalize(); } skeleton.setJoint(i, joint); } }
rad.setAll(radius, radius, radius); test_against_min = Vector3.subtractAndCreate(bs_position, rad); test_against_max = Vector3.addAndCreate(bs_position, rad); } else { RajLog.e("[" + this.getClass().getName() + "] Received a bounding box of unknown type.");
Vector3 pos = Vector3.addAndCreate(joint.getPosition(), rotPos); pos.multiply(weight.weightValue); position.add(pos);
private void buildFrameSkeleton(float[] frameData, Skeleton skeleton) { for(int i=0; i<mNumJoints; ++i) { SkeletonJoint joint = new SkeletonJoint(mBaseFrame[i]); SkeletonJoint jointInfo = mJoints[i]; joint.setParentIndex(jointInfo.getParentIndex()); int j = 0; int startIndex = jointInfo.getStartIndex(); if((jointInfo.getFlags() & 1) == 1) joint.getPosition().x = frameData[startIndex + j++]; if((jointInfo.getFlags() & 2) == 2) joint.getPosition().z = frameData[startIndex + j++]; if((jointInfo.getFlags() & 4) == 4) joint.getPosition().y = frameData[startIndex + j++]; if((jointInfo.getFlags() & 8) == 8) joint.getOrientation().x = frameData[startIndex + j++]; if((jointInfo.getFlags() & 16) == 16) joint.getOrientation().z = frameData[startIndex + j++]; if((jointInfo.getFlags() & 32) == 32) joint.getOrientation().y = frameData[startIndex + j++]; joint.getOrientation().computeW(); if (joint.getParentIndex() >= 0 ) // Has a parent joint { SkeletonJoint parentJoint = skeleton.getJoint(joint.getParentIndex()); Vector3 rotPos = parentJoint.getOrientation().multiply(joint.getPosition()); //We don't clone here because nothing will be able to use the quaternion scratch before we do joint.getPosition().setAll(Vector3.addAndCreate(parentJoint.getPosition(), rotPos)); joint.getOrientation().multiply(parentJoint.getOrientation()); joint.getOrientation().normalize(); } skeleton.setJoint(i, joint); } }