本文整理汇总了TypeScript中math/polyhedra.Polyhedron.largestFace方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Polyhedron.largestFace方法的具体用法?TypeScript Polyhedron.largestFace怎么用?TypeScript Polyhedron.largestFace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类math/polyhedra.Polyhedron
的用法示例。
在下文中一共展示了Polyhedron.largestFace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getCapAlignment
export function getCapAlignment(polyhedron: Polyhedron, cap: Cap) {
const isRhombicosidodecahedron = cap.type === 'cupola';
const orthoCaps = isRhombicosidodecahedron
? _.filter(
Cap.getAll(polyhedron),
cap => getCupolaGyrate(polyhedron, cap) === 'ortho',
)
: [];
const otherNormal =
orthoCaps.length > 0
? getSingle(orthoCaps)
.boundary()
.normal()
: polyhedron.largestFace().normal();
return isInverse(cap.normal(), otherNormal) ? 'para' : 'meta';
}
示例2: doTwist
// TODO deduplicate with expand/contract
function doTwist(
polyhedron: Polyhedron,
referenceName: string,
twist: Twist = 'left',
) {
const reference = Polyhedron.get(referenceName);
const isSnub = expansionType(polyhedron) === 'snub';
const f0 = polyhedron.largestFace();
const n = f0.numSides;
const twistFaces = getExpandedFaces(polyhedron, n);
const referenceFace =
_.find(reference.faces, face => isExpandedFace(reference, face, n)) ||
reference.getFace();
const referenceLength =
(referenceFace.distanceToCenter() / reference.edgeLength()) *
polyhedron.edgeLength();
const refFaces = getExpandedFaces(reference, n);
const angle = !isSnub
? getTwistSign(twist) * Math.abs(getSnubAngle(reference, refFaces))
: -getSnubAngle(polyhedron, twistFaces);
const snubTwist = angle > 0 ? 'left' : 'right';
const duplicated = isSnub
? polyhedron
: bisectEdgeFaces(twistFaces, snubTwist);
const endVertices = getResizedVertices(twistFaces, referenceLength, angle);
return {
animationData: {
start: duplicated,
endVertices,
},
result: isSnub
? joinEdgeFaces(twistFaces, snubTwist).withVertices(endVertices)
: undefined,
};
}