Using entity in calls to functions that expect queries?
brooks_talley
Member Posts: 27 ✭
I'm just getting started with FeatureScript, so this is probably really naive... but I've scoured the docs and done a lot of trial/error, and I'm still mystified.
I'm trying to create a feature to that makes ribs from edges that are the intersections of two faces, with the rib following a vector that's halfway between the two faces.
Here's the code in question:
The problem, I think, is that
What am I missing? I realize there are complexities here with curved faces and the direction of the x-axis on the two faces. But I'm not even getting far enough to have those problems; I'm less worried about the accuracy of the algorithm than the language mechanism of "I have an entity and need a query".
I'm trying to create a feature to that makes ribs from edges that are the intersections of two faces, with the rib following a vector that's halfway between the two faces.
Here's the code in question:
var averageNormal = vector(0, 0 , 0);
const adjacentFaces is Query = qEdgeAdjacent(edgeProfile, EntityType.FACE);
if (evaluateQuery(context, adjacentFaces) == []) {
throw regenError("Edge has no adjacent faces", edgeProfile);
}
for (var face in adjacentFaces) {
const faceNormal = evFaceNormalAtEdge(context, {"edge" : edgeProfile, "face" : face, "parameter" : 0.5});
averageNormal += faceNormal;
}
normalize(averageNormal);The problem, I think, is that
var face in adjacentFacesgets me an entity of EntityType.FACE. And evFaceNormalAtEdge wants the face to be a Query, like all of the ev* functions.
What am I missing? I realize there are complexities here with curved faces and the direction of the x-axis on the two faces. But I'm not even getting far enough to have those problems; I'm less worried about the accuracy of the algorithm than the language mechanism of "I have an entity and need a query".
Tagged:
0
Best Answer
-
you probably want to iterate through a list of queries, so you need
<code><code>evaluateQuery(context, adjacentFaces<span>);<br></span>for (var face in adjacentFaces){...}<code>adjacentFaces =
6
Answers
-
you probably want to iterate through a list of queries, so you need
<code><code>evaluateQuery(context, adjacentFaces<span>);<br></span>for (var face in adjacentFaces){...}<code>adjacentFaces =
6 -
Argh. Should have seen that. Thank you!0
