本文整理匯總了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));
}