本文整理汇总了Java中org.rajawali3d.math.vector.Vector3类的典型用法代码示例。如果您正苦于以下问题:Java Vector3类的具体用法?Java Vector3怎么用?Java Vector3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector3类属于org.rajawali3d.math.vector包,在下文中一共展示了Vector3类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: lookInto
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
@Override
public void lookInto(@NonNull Direction targetDirection) {
if (currentDirection == targetDirection) {
return; // nothing to do
}
performIntegrityCheck(targetDirection);
Vector3.Axis axis = currentDirection == Direction.AHEAD ?
DIRECTION_TO_AXIS.get(targetDirection) :
DIRECTION_TO_AXIS.get(currentDirection);
int angle = DIRECTION_TO_ANGLE.get(targetDirection) - DIRECTION_TO_ANGLE.get(currentDirection);
renderer.rotateModel(axis, angle, HeadOverlayView.ANIMATION_DURATION_IN_MILLIS);
currentDirection = targetDirection;
}
开发者ID:BioID-GmbH,项目名称:BWS-Android,代码行数:19,代码来源:RajawaliHeadOverlayView.java
示例2: rotateModel
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
/**
* Does rotate the 3D head by the specified angle around the specified axis.
*
* @param axis for the rotation
* @param angle for the rotation
* @param animationDurationInMillis how long the animation should take
*/
@SuppressWarnings("SameParameterValue")
void rotateModel(@NonNull Vector3.Axis axis, @IntRange(from = 0, to = 360) int angle,
@IntRange(from = 0) int animationDurationInMillis) {
if (!getSceneInitialized()) {
return;
}
stopActiveAnimation();
Animation3D animation = new RotateOnAxisAnimation(axis, angle);
animation.setDurationMilliseconds(animationDurationInMillis);
animation.setTransformable3D(head);
animation.play();
getCurrentScene().registerAnimation(animation);
lastAnimation = animation;
}
开发者ID:BioID-GmbH,项目名称:BWS-Android,代码行数:25,代码来源:RajawaliHeadRenderer.java
示例3: getCatEar
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
private Ornament getCatEar() {
Ornament ornament = new Ornament();
ornament.setModelResId(R.raw.cat_ear_obj);
ornament.setImgResId(R.drawable.ic_cat);
ornament.setScale(11.0f);
ornament.setOffset(0, 0.6f, -0.2f);
ornament.setRotate(0.0f, 0.0f, 0.0f);
ornament.setColor(0xffe06666);
List<Animation3D> animation3Ds = new ArrayList<>();
Animation3D anim = new RotateOnAxisAnimation(Vector3.Axis.X, -30);
anim.setDurationMilliseconds(300);
anim.setInterpolator(new AccelerateDecelerateInterpolator());
anim.setRepeatCount(2);
animation3Ds.add(anim);
ornament.setAnimation3Ds(animation3Ds);
return ornament;
}
开发者ID:SimonCherryGZ,项目名称:face-landmark-android,代码行数:20,代码来源:ARFacePresenter.java
示例4: getHeart
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
private Ornament getHeart() {
Ornament ornament = new Ornament();
ornament.setModelResId(R.raw.heart_eyes_obj);
ornament.setImgResId(R.drawable.ic_heart);
ornament.setScale(0.17f);
ornament.setOffset(0, 0.0f, 0.1f);
ornament.setRotate(0.0f, 0.0f, 0.0f);
ornament.setColor(0xffcc0000);
List<Animation3D> animation3Ds = new ArrayList<>();
Animation3D anim = new ScaleAnimation3D(new Vector3(0.3f, 0.3f, 0.3f));
anim.setDurationMilliseconds(300);
anim.setInterpolator(new LinearInterpolator());
animation3Ds.add(anim);
ornament.setAnimation3Ds(animation3Ds);
return ornament;
}
开发者ID:SimonCherryGZ,项目名称:face-landmark-android,代码行数:18,代码来源:ARFacePresenter.java
示例5: calculatePoint
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
/**
* Calculates the position on the spiral for the specified polar angle. This takes an additional
* parameter of a {@link Vector3} which will be set to the calculated position.
*
* @param result {@link Vector3} to set with the updated position.
* @param theta {@code double} the polar angle to calculate for, in degrees.
*/
@Override
public void calculatePoint(Vector3 result, double theta) {
final double angle = mSpiralIn ? mThetaOffset + theta : theta - mThetaOffset;
final double r = a * Math.exp(mDensity * angle);
// Update the rotation
mRotation.fromAngleAxis(mUp, Math.toDegrees(angle)); //.inverse();
// Rotate the start-end vector based on the angle
mScratch.setAll(mRotation.multiply(mStart)).normalize();
// Set the correct length
result.setAll(mScratch.multiply(r));
if (mCalculateTangents) {
mCurrentTangent.crossAndSet(mUp, mScratch);
}
}
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:25,代码来源:LogarithmicSpiral3D.java
示例6: applyRotation
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
private void applyRotation()
{
if (mIsRotating)
{
mapToSphere((float) mPrevScreenCoord.getX(), (float) mPrevScreenCoord.getY(), mPrevSphereCoord);
mapToSphere((float) mCurrScreenCoord.getX(), (float) mCurrScreenCoord.getY(), mCurrSphereCoord);
Vector3 rotationAxis = mPrevSphereCoord.clone();
rotationAxis.cross(mCurrSphereCoord);
rotationAxis.normalize();
double rotationAngle = Math.acos(Math.min(1, mPrevSphereCoord.dot(mCurrSphereCoord)));
mCurrentOrientation.fromAngleAxis(rotationAxis, MathUtil.radiansToDegrees(rotationAngle));
mCurrentOrientation.normalize();
Quaternion q = new Quaternion(mStartOrientation);
q.multiply(mCurrentOrientation);
mEmpty.setOrientation(q);
}
}
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:22,代码来源:ArcballCamera.java
示例7: calculateBounds
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
public void calculateBounds(Geometry3D geometry) {
double radius = 0, maxRadius = 0;
Vector3 vertex = new Vector3();
FloatBuffer vertices = geometry.getVertices();
vertices.rewind();
while(vertices.hasRemaining()) {
vertex.x = vertices.get();
vertex.y = vertices.get();
vertex.z = vertices.get();
radius = vertex.length();
if(radius > maxRadius) maxRadius = radius;
}
mRadius = maxRadius;
}
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:17,代码来源:BoundingSphere.java
示例8: calculateBounds
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
public void calculateBounds(Geometry3D geometry) {
FloatBuffer vertices = geometry.getVertices();
vertices.rewind();
mMin.setAll(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE);
mMax.setAll(-Double.MAX_VALUE, -Double.MAX_VALUE, -Double.MAX_VALUE);
Vector3 vertex = new Vector3();
while (vertices.hasRemaining()) {
vertex.x = vertices.get();
vertex.y = vertices.get();
vertex.z = vertices.get();
if(vertex.x < mMin.x) mMin.x = vertex.x;
if(vertex.y < mMin.y) mMin.y = vertex.y;
if(vertex.z < mMin.z) mMin.z = vertex.z;
if(vertex.x > mMax.x) mMax.x = vertex.x;
if(vertex.y > mMax.y) mMax.y = vertex.y;
if(vertex.z > mMax.z) mMax.z = vertex.z;
}
calculatePoints();
}
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:24,代码来源:BoundingBox.java
示例9: matrixToTangoPose
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
/**
* Converts a transform in Matrix4 format to TangoPoseData.
*/
public static TangoPoseData matrixToTangoPose(Matrix4 transform) {
// Get translation and rotation components from the transformation matrix.
Vector3 p = transform.getTranslation();
Quaternion q = new Quaternion();
q.fromMatrix(transform);
TangoPoseData tangoPose = new TangoPoseData();
double[] t = tangoPose.translation = new double[3];
t[0] = p.x;
t[1] = p.y;
t[2] = p.z;
double[] r = tangoPose.rotation = new double[4];
r[0] = q.x;
r[1] = q.y;
r[2] = q.z;
r[3] = q.w;
return tangoPose;
}
开发者ID:inovex,项目名称:tango-ar-navigation-example,代码行数:23,代码来源:ScenePoseCalculator.java
示例10: performIntegrityCheck
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
private void performIntegrityCheck(@NonNull Direction targetDirection) {
if (currentDirection == Direction.AHEAD || targetDirection == Direction.AHEAD) {
return; // nothing bad can happen
}
Vector3.Axis axisForCurrentDirection = DIRECTION_TO_AXIS.get(currentDirection);
Vector3.Axis axisForTargetDirection = DIRECTION_TO_AXIS.get(targetDirection);
if (axisForCurrentDirection != axisForTargetDirection) {
throw new IllegalStateException("The 3D head does not support diagonal animations.");
}
}
开发者ID:BioID-GmbH,项目名称:BWS-Android,代码行数:13,代码来源:RajawaliHeadOverlayView.java
示例11: initialize
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
private void initialize() {
mStartFOV = mFieldOfView;
mLookAtEnabled = true;
setLookAt(0, 0, 0);
mEmpty = new Object3D();
mScratchMatrix = new Matrix4();
mScratchVector = new Vector3();
mCameraStartPos = new Vector3();
mPrevSphereCoord = new Vector3();
mCurrSphereCoord = new Vector3();
mPrevScreenCoord = new Vector2();
mCurrScreenCoord = new Vector2();
mStartOrientation = new Quaternion();
mCurrentOrientation = new Quaternion();
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:16,代码来源:ArcballCamera.java
示例12: setToScale
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
/**
* Sets this {@link Matrix4} to a scale matrix based on the provided {@link Vector3}.
*
* @param vec {@link Vector3} describing the scaling components.
* @return A reference to this {@link Matrix4} to facilitate chaining.
*/
public Matrix4 setToScale(final Vector3 vec) {
identity();
m[M00] = vec.x;
m[M11] = vec.y;
m[M22] = vec.z;
return this;
}
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:14,代码来源:Matrix4.java
示例13: SplineTranslateAnimation3D
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
public SplineTranslateAnimation3D(ICurve3D splinePath) {
super();
mSplinePath = splinePath;
mTempPoint1 = new Vector3();
mTempPoint2 = new Vector3();
}
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:8,代码来源:SplineTranslateAnimation3D.java
示例14: QuadraticBezierCurve3D
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
public QuadraticBezierCurve3D(Vector3 point1, Vector3 controlPoint, Vector3 point2)
{
this();
mTmpPoint1 = new Vector3();
mTmpPoint2 = new Vector3();
mTmpPoint3 = new Vector3();
addPoint(point1, controlPoint, point2);
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:9,代码来源:QuadraticBezierCurve3D.java
示例15: setAll
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
/**
* Sets the values of this {@link Matrix4} to the values corresponding to a Translation x Scale x Rotation.
* This is useful for composing a model matrix as efficiently as possible, eliminating any extraneous calculations.
*
* @param position {@link Vector3} representing the translation.
* @param scale {@link Vector3} representing the scaling.
* @param rotation {@link Quaternion} representing the rotation.
* @return A reference to this {@link Matrix4} to facilitate chaining.
*/
public Matrix4 setAll(final Vector3 position, final Vector3 scale, final Quaternion rotation) {
// Precompute these factors for speed
final double x2 = rotation.x * rotation.x;
final double y2 = rotation.y * rotation.y;
final double z2 = rotation.z * rotation.z;
final double xy = rotation.x * rotation.y;
final double xz = rotation.x * rotation.z;
final double yz = rotation.y * rotation.z;
final double wx = rotation.w * rotation.x;
final double wy = rotation.w * rotation.y;
final double wz = rotation.w * rotation.z;
// Column 0
m[M00] = scale.x * (1.0 - 2.0 * (y2 + z2));
m[M10] = 2.0 * scale.y * (xy - wz);
m[M20] = 2.0 * scale.z * (xz + wy);
m[M30] = 0;
// Column 1
m[M01] = 2.0 * scale.x * (xy + wz);
m[M11] = scale.y * (1.0 - 2.0 * (x2 + z2));
m[M21] = 2.0 * scale.z * (yz - wx);
m[M31] = 0;
// Column 2
m[M02] = 2.0 * scale.x * (xz - wy);
m[M12] = 2.0 * scale.y * (yz + wx);
m[M22] = scale.z * (1.0 - 2.0 * (x2 + y2));
m[M32] = 0;
// Column 3
m[M03] = position.x;
m[M13] = position.y;
m[M23] = position.z;
m[M33] = 1.0;
return this;
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:47,代码来源:Matrix4.java
示例16: getIntersection
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
private boolean getIntersection( double fDst1, double fDst2, Vector3 P1, Vector3 P2) {
if ((fDst1 * fDst2) >= 0.0f) return false;
if (floatEqual(fDst1, fDst2)) return false;
mHitPoint.setAll(P1);
mHitPoint.add(Vector3.subtractAndCreate(P2, P1));
mHitPoint.multiply(-fDst1/(fDst2-fDst1));
return true;
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:9,代码来源:RayPickingVisitor.java
示例17: setTranslation
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
/**
* Sets the translation of this {@link Matrix4} based on the provided {@link Vector3}.
*
* @param vec {@link Vector3} describing the translation components.
* @return A reference to this {@link Matrix4} to facilitate chaining.
*/
public Matrix4 setTranslation(final Vector3 vec) {
m[M03] = vec.x;
m[M13] = vec.y;
m[M23] = vec.z;
return this;
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:13,代码来源:Matrix4.java
示例18: Destroyer
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
/**
* This class holds status parameters of enemy and controls the movement
* @param obj 3D object instance
*/
public Destroyer(Object3D obj) {
super(obj);
loc = new Vector3(0, 0, 0);
object = obj;
initBoundingBox();
}
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:11,代码来源:Destroyer.java
示例19: getScaling
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
/**
* Creates a new {@link Vector3} representing the scaling component
* of this {@link Matrix4}.
*
* @return {@link Vector3} representing the scaling.
*/
public Vector3 getScaling() {
final double x = Math.sqrt(m[M00]*m[M00] + m[M01]*m[M01] + m[M02]*m[M02]);
final double y = Math.sqrt(m[M10]*m[M10] + m[M11]*m[M11] + m[M12]*m[M12]);
final double z = Math.sqrt(m[M20]*m[M20] + m[M21]*m[M21] + m[M22]*m[M22]);
return new Vector3(x, y, z);
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:13,代码来源:Matrix4.java
示例20: setToLookAt
import org.rajawali3d.math.vector.Vector3; //导入依赖的package包/类
/**
* Sets this {@link Matrix4} to a look at matrix with a direction and up {@link Vector3}.
* You can multiply this with a translation {@link Matrix4} to get a camera Model-View matrix.
*
* @param direction {@link Vector3} The look direction.
* @param up {@link Vector3} The up axis.
* @return A reference to this {@link Matrix4} to facilitate chaining.
*/
public Matrix4 setToLookAt(final Vector3 direction, final Vector3 up) {
mVec3.setAll(direction).normalize();
mVec1.setAll(direction).normalize();
mVec1.cross(up).normalize();
mVec2.setAll(mVec1).cross(mVec3).normalize();
identity();
m[M00] = mVec1.x; m[M01] = mVec1.y; m[M02] = mVec1.z;
m[M10] = mVec2.x; m[M11] = mVec2.y; m[M12] = mVec2.z;
m[M20] = mVec3.x; m[M21] = mVec3.y; m[M22] = mVec3.z;
return this;
}
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:20,代码来源:Matrix4.java
注:本文中的org.rajawali3d.math.vector.Vector3类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论