本文整理汇总了Java中org.joml.Vector3f.z方法的典型用法代码示例。如果您正苦于以下问题:Java Vector3f.z方法的具体用法?Java Vector3f.z怎么用?Java Vector3f.z使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joml.Vector3f
的用法示例。
在下文中一共展示了Vector3f.z方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: intersects
import org.joml.Vector3f; //导入方法依赖的package包/类
@Override
public Intersection intersects(Vector3fc geomOrigin, Ray ray) {
float nDotRaySegment = normal.dot(ray.segment);
if( nDotRaySegment == 0) {
return null;
}
Vector3f origin = new Vector3f(axisH).add(axisV).div(2).negate().add(geomOrigin);
float d = normal.dot(origin);
float nDotRayOrigin = normal.dot(ray.origin);
float t = (d - nDotRayOrigin)/nDotRaySegment;
if( t<0 ) {
return null;
}
Vector3f ending = new Vector3f(origin).add(axisH).add(axisV);
Vector3f point = new Vector3f(ray.segment).mul(t).add(ray.origin);
if( point.x < origin.x()-0.000001f
|| point.y < origin.y()-0.000001f
|| point.z < origin.z()-0.000001f
|| point.x > ending.x()+0.000001f
|| point.y > ending.y()+0.000001f
|| point.z > ending.z()+0.000001f) {
return null;
}
Intersection intersection = new Intersection();
intersection.point = point;
intersection.normal = new Vector3f(normal);
return intersection;
}
示例2: getChunk
import org.joml.Vector3f; //导入方法依赖的package包/类
public static Vector3i getChunk(Vector3f pos) {
return new Vector3i(pos.x() < 0.f ? (int)pos.x() / Chunk.CHUNK_SIZE - 1 : (int)pos.x() / Chunk.CHUNK_SIZE,
pos.y() < 0.f ? (int)pos.y() / Chunk.CHUNK_SIZE - 1 : (int)pos.y() / Chunk.CHUNK_SIZE,
pos.z() < 0.f ? (int)pos.z() / Chunk.CHUNK_SIZE - 1 : (int)pos.z() / Chunk.CHUNK_SIZE);
}