本文整理汇总了Java中toxi.geom.Vec3D.dot方法的典型用法代码示例。如果您正苦于以下问题:Java Vec3D.dot方法的具体用法?Java Vec3D.dot怎么用?Java Vec3D.dot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toxi.geom.Vec3D
的用法示例。
在下文中一共展示了Vec3D.dot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SculptureSection
import toxi.geom.Vec3D; //导入方法依赖的package包/类
/**
* Constructs a sculpture section
*
* @param center the section center
* @param normal the section plane normal
* @param radius the section radius
* @param sides the number of section sides
* @param referencePoint the reference point from the previous section
* @param referenceNormal the normal vector from the previous section
*/
public SculptureSection(Vec3D center, Vec3D normal, float radius, int sides, Vec3D referencePoint,
Vec3D referenceNormal) {
this.center = center.copy();
this.normal = normal.copy();
this.points = new Vec3D[Math.max(2, sides)];
// Calculate the intersection point between the line defined by the reference point and the reference normal
// and the section plane
float c = (this.center.dot(this.normal) - referencePoint.dot(this.normal)) / referenceNormal.dot(this.normal);
Vec3D intersectionPoint = referenceNormal.scale(c).addSelf(referencePoint);
// Calculate the section points
Vec3D perpendicularPoint = intersectionPoint.subSelf(this.center).normalizeTo(radius);
float deltaAngle = PApplet.TWO_PI / sides;
for (int i = 0; i < this.points.length; i++) {
this.points[i] = this.center.add(perpendicularPoint);
perpendicularPoint.rotateAroundAxis(this.normal, deltaAngle);
}
}