本文整理汇总了TypeScript中utils.find函数的典型用法代码示例。如果您正苦于以下问题:TypeScript find函数的具体用法?TypeScript find怎么用?TypeScript find使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: find
const truncatedVertices = duplicated.vertices.map(vertex => {
const adjacentVertices = vertex.adjacentVertices();
const v = vertex.vec;
const v1 = find(adjacentVertices, adj => adj.vec.distanceTo(v) > PRECISION);
const truncated = v.interpolateTo(v1.vec, rectify ? 0.5 : truncateScale);
return !!transform ? transform(truncated, vertex) : truncated;
});
示例2: return
return (vector, vertex) => {
const smallFace = find(vertex.adjacentFaces(), {
numSides: 6,
});
const normal = smallFace.withPolyhedron(polyhedron).normal();
const transform = withOrigin(smallFace.centroid(), v =>
v
.scale(faceResizeScale)
.add(normal.scale(normalizedResizeAmount * newSideLength)),
);
return transform(vector);
};
示例3: getChirality
export function getChirality(polyhedron: Polyhedron) {
const [cap1, cap2] = Cap.getAll(polyhedron);
const boundary = cap1.boundary();
const isCupolaRotunda = cap1.type !== cap2.type;
const nonTriangleFace = find(boundary.edges, e => e.face.numSides !== 3);
const rightFaceAcross = nonTriangleFace
.twin()
.prev()
.twin()
.next()
.twin().face;
// I'm pretty sure this is the same logic as in augment
if (isCupolaRotunda) {
return rightFaceAcross.numSides !== 3 ? 'right' : 'left';
}
return rightFaceAcross.numSides !== 3 ? 'left' : 'right';
}
示例4: prevEdge
prevEdge(e: Edge) {
return find(this.edges, e2 => e2.v2.equals(e.v1));
}
示例5: nextEdge
nextEdge(e: Edge) {
return find(this.edges, e2 => e2.v1.equals(e.v2));
}