当前位置: 首页>>代码示例>>Java>>正文


Java Vec3D.dot方法代码示例

本文整理汇总了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);
	}
}
 
开发者ID:jagracar,项目名称:kinectSketches,代码行数:31,代码来源:SculptureSection.java


注:本文中的toxi.geom.Vec3D.dot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。