Isotropix Forums

dist function - how to use it (strange errors)

Discuss about expressions in Clarisse

dist function - how to use it (strange errors)

Unread postby atnreg » Thu Feb 07, 2019 3:11 pm

Hi!

Expressions are great and thanks for this forum section but I seem to have problems using them :oops:
Very basic expressions work but I wanted to try the functions and got into problems.

I made simple test to make a box x coordinate match distance between two other boxes.
The expression code for box_dist.translate.x is:
Code: Select all
p1=get_vec3("box_p1.translate");
p2=get_vec3("box_p2.translate");
d=sqrt((p1[0]-p2[0])^2+(p1[1]-p2[1])^2+(p1[2]-p2[2])^2); # works fine
#d=dist(p1,p2); # does not work, strange errors :o
d


Can you please tell me what I am doing wrong?

The errors I get are (comment out the sqrt and uncomment the dist line):
Expression bound on project://box_dist.translate[0] failed to compile:
Line 4 Col -47 - Too few args for function dist
Line 4 Col -49 - Assignment operation has bad type: lifetime_error Error

Too few args???? The manual says two vectors and those are two vectors :)
Lifetime_error????? :D

Thank you!

Antti
Antti
AMD Ryzen Threadripper 2990wx (32c/64t),64GB RAM,NVIDIA RTX 3090,Win10
UE5,Clarisse 5.0(always latest SP),Houdini,Blender,ZBrush,Onyx...
Started: Clarisse 2016/10 (Py 2017/01), Python 2016/11
No business, just fun :)
atnreg
 
Posts: 599
Joined: Mon Sep 19, 2016 4:20 pm
Location: Helsinki, Finland

Re: dist function - how to use it (strange errors)

Unread postby dcourtois » Thu Feb 07, 2019 4:26 pm

Hi Antii,

The 'dist' function is a native SeExpr one, and the documentation is incorrect (see the official SeExpr documentation)
The correct signature of dist is in fact `dist(ax, ay, az, bx, by, bz)`
In your example, this expression should work:

Code: Select all
p1 = get_vec3("box_p1.translate");
p2 = get_vec3("box_p2.translate");

# sidenote: the very last statement is what's used as the expression's result, so you don't need
# to write 'd = dist(...)' :
dist(p1[0], p1[1], p1[2], p2[0], p2[1], p2[2])


Hope this helps !
User avatar
dcourtois
 
Posts: 129
Joined: Tue Jul 25, 2017 3:15 pm

Re: dist function - how to use it (strange errors)

Unread postby atnreg » Thu Feb 07, 2019 4:38 pm

Ah ok, does that apply to other SeExpr functions as well? So we should use the official docs and not Clarisse docs?
That does not help with printf though (see my other post), the syntax is the same in both docs so please help me there :)

I will check that documentation, thank you!

Yes dist works now :mrgreen:

Antti
Last edited by atnreg on Thu Feb 07, 2019 4:40 pm, edited 2 times in total.
Antti
AMD Ryzen Threadripper 2990wx (32c/64t),64GB RAM,NVIDIA RTX 3090,Win10
UE5,Clarisse 5.0(always latest SP),Houdini,Blender,ZBrush,Onyx...
Started: Clarisse 2016/10 (Py 2017/01), Python 2016/11
No business, just fun :)
atnreg
 
Posts: 599
Joined: Mon Sep 19, 2016 4:20 pm
Location: Helsinki, Finland

Re: dist function - how to use it (strange errors)

Unread postby sam » Thu Feb 07, 2019 4:38 pm

Unfortunately it seems the official SeExpr doc isn't completely accurate. As we didn't test every single function there may be many other functions that aren't documented properly. Our own documentation is based on the official one....
Sam Assadian
Isotropix
CEO/Founder
User avatar
sam
 
Posts: 1881
Joined: Fri Jan 25, 2013 11:33 pm

Re: dist function - how to use it (strange errors)

Unread postby sam » Thu Feb 07, 2019 4:39 pm

atnreg wrote:Ah ok, does that apply to other SeExpr functions as well? So we should use the official docs and not Clarisse docs?
That does not help with printf though (see my other post), the syntax is the same in both docs so please help me there :)

I will check that documentation, thank you!

Antti

No the official doc is wrong, and as ours is based on it, it is wrong too...
Sam Assadian
Isotropix
CEO/Founder
User avatar
sam
 
Posts: 1881
Joined: Fri Jan 25, 2013 11:33 pm

Re: dist function - how to use it (strange errors)

Unread postby atnreg » Thu Feb 07, 2019 4:43 pm

sam wrote:
atnreg wrote:Ah ok, does that apply to other SeExpr functions as well? So we should use the official docs and not Clarisse docs?
That does not help with printf though (see my other post), the syntax is the same in both docs so please help me there :)

I will check that documentation, thank you!

Antti

No the official doc is wrong, and as ours is based on it, it is wrong too...


Oh, hmm...then HOW we are supposed to know how to use those? :D
And furthermore, how do YOU know how to use them, as far as I understand you have had that feature in your internal version for a while (I remember seeing that zigma sign in some videos quite a long time ago)? :)

Antti
Antti
AMD Ryzen Threadripper 2990wx (32c/64t),64GB RAM,NVIDIA RTX 3090,Win10
UE5,Clarisse 5.0(always latest SP),Houdini,Blender,ZBrush,Onyx...
Started: Clarisse 2016/10 (Py 2017/01), Python 2016/11
No business, just fun :)
atnreg
 
Posts: 599
Joined: Mon Sep 19, 2016 4:20 pm
Location: Helsinki, Finland

Re: dist function - how to use it (strange errors)

Unread postby sam » Thu Feb 07, 2019 4:47 pm

atnreg wrote:Oh, hmm...then HOW we are supposed to know how to use those? :D

We are exactly in the same position as you are. We connected the SeExpr to Clarisse and added specific extensions: https://clarissewiki.com/4.0/clarisse-specifics.html

So for the "standard" SeExpr we have the exact same amount of resources as you have (and little bit more experience)
Sam Assadian
Isotropix
CEO/Founder
User avatar
sam
 
Posts: 1881
Joined: Fri Jan 25, 2013 11:33 pm

Re: dist function - how to use it (strange errors)

Unread postby atnreg » Thu Feb 07, 2019 5:32 pm

sam wrote:
atnreg wrote:Oh, hmm...then HOW we are supposed to know how to use those? :D

We are exactly in the same position as you are. We connected the SeExpr to Clarisse and added specific extensions: https://clarissewiki.com/4.0/clarisse-specifics.html

So for the "standard" SeExpr we have the exact same amount of resources as you have (and little bit more experience)


Ok, then you will receive a lot of questions on how to use them (I believe not only from me), beware :mrgreen:

Antti
Antti
AMD Ryzen Threadripper 2990wx (32c/64t),64GB RAM,NVIDIA RTX 3090,Win10
UE5,Clarisse 5.0(always latest SP),Houdini,Blender,ZBrush,Onyx...
Started: Clarisse 2016/10 (Py 2017/01), Python 2016/11
No business, just fun :)
atnreg
 
Posts: 599
Joined: Mon Sep 19, 2016 4:20 pm
Location: Helsinki, Finland


Return to Expressions