本文整理汇总了Java中javax.vecmath.Vector4d类的典型用法代码示例。如果您正苦于以下问题:Java Vector4d类的具体用法?Java Vector4d怎么用?Java Vector4d使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector4d类属于javax.vecmath包,在下文中一共展示了Vector4d类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: transform_now
import javax.vecmath.Vector4d; //导入依赖的package包/类
private Vector4d transform_now(String source, String target, Vector4d point) throws InterruptedException, TransformerException {
long when = System.currentTimeMillis();
Thread.sleep(30);
if (receiver.canTransform(target, source, when)) {
Transform trafo = receiver.lookupTransform(target, source, when);
System.out.println("[" + trafo.getFrameChild() + "] --> " + "[" + trafo.getFrameParent() + "]");
Vector4d point4d = new Vector4d(point.x, point.y, point.z, 1.0);
trafo.getTransform().transform(point4d);
return point4d;
} else {
System.out.println("Error: Cannot transfrom " + source + " --> " + target);
return new Vector4d();
}
}
开发者ID:leonziegler,项目名称:rct-java,代码行数:19,代码来源:Cross_lib_provider.java
示例2: test
import javax.vecmath.Vector4d; //导入依赖的package包/类
private void test() throws InterruptedException, TransformerException, TransformerFactory.TransformerFactoryException {
receiver = TransformerFactory.getInstance().createTransformReceiver();
System.out.println("Gathering available transformations ...");
Thread.sleep(1000);
// The different systems and the base
String[] targets = {"java_static", "java_dynamic", "python_static", "python_dynamic"};
String base = "base";
Vector4d point = new Vector4d(1.0, 1.0, 1.0, 1.0);
System.out.println("Point to transform: " + point + "\n");
for (String target : targets) {
// Forward transfrom
Vector4d transformed_point = transform_now(base, target, point);
System.out.println("[" + point + "] --> " + "[" + transformed_point + "]");
// Backward transfrom
Vector4d re_transformed_point = transform_now(target, base, transformed_point);
System.out.println("[" + transformed_point + "] --> " + "[" + re_transformed_point + "]");
System.out.println("");
}
System.exit(0);
}
开发者ID:leonziegler,项目名称:rct-java,代码行数:27,代码来源:Cross_lib_provider.java
示例3: locTrans
import javax.vecmath.Vector4d; //导入依赖的package包/类
private float[] locTrans(int[] fs, Matrix4d viewMatrix) {
Vector4d loc =new Vector4d(
Math.floor( ( fs[0] ) + 0.5),
Math.floor( ( fs[1] ) + 0.5),
Math.floor( ( fs[2] ) + 0.5),
1);
viewMatrix.transform(loc);
return new float[] { (float) loc.x, (float) loc.y , (float) loc.z};
}
开发者ID:twak,项目名称:chordatlas,代码行数:13,代码来源:ReadTrace.java
示例4: readVector4d
import javax.vecmath.Vector4d; //导入依赖的package包/类
public static Vector4d readVector4d(ByteBuffer bf) {
Vector4d v = new Vector4d();
v.x = bf.getFloat();
v.y = bf.getFloat();
v.z = bf.getFloat();
v.w = bf.getFloat();
return v;
}
开发者ID:xtremexp,项目名称:UT4Converter,代码行数:11,代码来源:BinUtils.java
示例5: writeVector4d
import javax.vecmath.Vector4d; //导入依赖的package包/类
public static void writeVector4d(FileOutputStream bos, Vector4d v) throws IOException {
writeFloat(bos, (float) v.x);
writeFloat(bos, (float) v.y);
writeFloat(bos, (float) v.z);
writeFloat(bos, (float) v.x);
}
开发者ID:xtremexp,项目名称:UT4Converter,代码行数:8,代码来源:BinUtils.java
示例6: transform
import javax.vecmath.Vector4d; //导入依赖的package包/类
/** returns a copy of this quad with the given transformation applied */
public RawQuad transform(Matrix4d matrix)
{
RawQuad result = this.clone();
// transform vertices
for(int i = 0; i < result.vertexCount; i++)
{
Vertex vertex = result.getVertex(i);
Vector4d temp = new Vector4d(vertex.x, vertex.y, vertex.z, 1.0);
matrix.transform(temp);
if(Math.abs(temp.w - 1.0) > 1e-5) temp.scale(1.0 / temp.w);
result.setVertex(i, vertex.withXYZ(temp.x, temp.y, temp.z));
}
// transform nominal face
// our matrix transform has block center as its origin,
// so need to translate face vectors to/from block center
// origin before/applying matrix.
if(this.face != null)
{
Vec3i curNorm = this.face.getDirectionVec();
Vector4d newFaceVec = new Vector4d(curNorm.getX() + 0.5, curNorm.getY() + 0.5, curNorm.getZ() + 0.5, 1.0);
matrix.transform(newFaceVec);
newFaceVec.x -= 0.5;
newFaceVec.y -= 0.5;
newFaceVec.z -= 0.5;
result.setFace(QuadHelper.computeFaceForNormal(newFaceVec));
}
return result;
}
开发者ID:grondag,项目名称:Hard-Science,代码行数:33,代码来源:RawQuad.java
示例7: transform
import javax.vecmath.Vector4d; //导入依赖的package包/类
public Point3d transform(Vector4d vec) {
Vector4d res = new Vector4d();
P.transform(vec, res);
Point3d p = new Point3d(res.x, res.y, res.z);
if (Math.abs(p.z) < EPS) { // point at infinity
p.z = 0;
} else if (p.z > 0) {
p.scale(1.0 / p.z);
}// else point is behind of camera
return p;
}
开发者ID:sdghrmz,项目名称:jvircam,代码行数:12,代码来源:Projection.java
示例8: vanishingPoint
import javax.vecmath.Vector4d; //导入依赖的package包/类
public Point2d vanishingPoint(Vector3d vec) {
Point3d p = this.transform(new Vector4d(vec.x, vec.y, vec.z, 0.0));
if (p.z > 0) {
return new Point2d(p.x, p.y);
}
return null;
}
开发者ID:sdghrmz,项目名称:jvircam,代码行数:8,代码来源:Projection.java
示例9: planeDist
import javax.vecmath.Vector4d; //导入依赖的package包/类
private double planeDist(Point3d pt, Vector4d plane)
{
return pt.x * plane.x + pt.y * plane.y + pt.z * plane.z + plane.w;
}
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:5,代码来源:SlicePlaneRenderer.java
示例10: setWeightmapScaleBias
import javax.vecmath.Vector4d; //导入依赖的package包/类
public void setWeightmapScaleBias(Vector4d weightmapScaleBias) {
this.weightmapScaleBias = weightmapScaleBias;
}
开发者ID:xtremexp,项目名称:UT4Converter,代码行数:4,代码来源:LandscapeComponent.java
示例11: setHeightmapScaleBias
import javax.vecmath.Vector4d; //导入依赖的package包/类
public void setHeightmapScaleBias(Vector4d heightmapScaleBias) {
this.heightmapScaleBias = heightmapScaleBias;
}
开发者ID:xtremexp,项目名称:UT4Converter,代码行数:4,代码来源:LandscapeComponent.java
示例12: computeFaceForNormal
import javax.vecmath.Vector4d; //导入依赖的package包/类
public static EnumFacing computeFaceForNormal(Vector4d normal)
{
return computeFaceForNormal(new Vec3d(normal.x, normal.y, normal.z));
}
开发者ID:grondag,项目名称:Hard-Science,代码行数:5,代码来源:QuadHelper.java
注:本文中的javax.vecmath.Vector4d类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论