You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great to capture parts of an expression as a variable that could be reused inline.
Here is a motivating example:
# get plane normal
normal = eval_expression('axis(plane.matrix, 1)', 'proj')
# project vector to plane
eval_expression('src.translate - ({normal} * dot(src.translate, {normal}))'.format(normal=normal), 'proj')
The normal gets used twice in expression, therefore it needs to be evaluated separately if it is to be reused. What if we could do something like this instead:
It would be great to capture parts of an expression as a variable that could be reused inline.
Here is a motivating example:
The normal gets used twice in expression, therefore it needs to be evaluated separately if it is to be reused. What if we could do something like this instead:
eval_expression('src.translate - (normal * dot(src.translate, axis(plane.matrix, 1)->normal))', 'proj')
Exact syntax is TBD.
One thing to consider is that capture would need to happen on the first use of the expression segment as per operation order.
Alternative proposal is to detect duplicate sections by comparing the AST nodes and reuse output internally, so you would still write:
eval_expression('src.translate - (axis(plane.matrix, 1) * dot(src.translate, axis(plane.matrix, 1)))', 'proj')
Feedback welcomed!
The text was updated successfully, but these errors were encountered: