Finer Control of a Dot Product ?

   2563   10   1
User Avatar
Member
767 posts
Joined: April 2014
Offline
Is it possible to have finer grain control over primitives in a wrangler with a dot product; considering a add node is responsible for controlling the dot product ?
【T】【C】【S】
User Avatar
Member
459 posts
Joined: Oct. 2011
Offline
If you supplied a small example, this would be a lot easier to understand.

-b
http://www.racecar.no [www.racecar.no]
User Avatar
Member
767 posts
Joined: April 2014
Offline
I'm wondering if I'm using this right by using the function RayHitTest to hit a primitive if it's strictly parallel to a point ?
【T】【C】【S】
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
As bonsak suggested…maybe you could upload a hip so we can see what your doing?
User Avatar
Member
767 posts
Joined: April 2014
Offline
This was the help I was given on a particular issue.
Embedded in the code are questions. Instead of posting the HIP file I want to understand the theory

vector target = point(@OpInput2, "P", 0);
vector aim = normalize(@target - @P);
v@am = normalize(target - @P); 
/* Why does one target attribute have "@" and the other doesn't ?*/
@facing = ceil((dot(@N, aim))); 
f@hitMark = rayhittest(@P,@facing,0); 
/* I'm hoping the rayhittest function can check if primitives are strictly parallel to the point which means because of the dot product if there are extra primitives; those primitives should not be included; I hope that was clear ? :)
Shouldn't @facing be declaired as a vector or float  */
@Cd = @facing;
float clramp = chramp("Facing",@facing);
@Cd = set(clramp,0,0);
【T】【C】【S】
User Avatar
Member
16 posts
Joined: March 2016
Offline
Christopher R
Why does one target attribute have “@” and the other doesn't ?

Shouldn't @facing be declaired as a vector or float

1. @target is referencing an attribute called “target” that lives on your geo, whereas the other “target” is a variable from line 1 that only lives inside this VEX code. Attributes require “@” notation, variables do not.

2. @facing is an integer because you're using ceil() to raise the result of the dot product to the next whole number. A dot product returns a float from -1 to 1, so ceil(dot()) will return either 0 or 1, depending on whether the aim vector is aiming more or less than 90 degrees away from the Normal vector.

EDIT: Although, since you're not declaring a type when creating @facing, it is defaulting to float, so actually it's a float value of either 0.0 or 1.0
Edited by VFXLife - Dec. 13, 2016 20:14:42
User Avatar
Member
767 posts
Joined: April 2014
Offline
VFXLife
@target is referencing an attribute called “target” that lives on your geo, whereas the other “target” is a variable from line 1 that only lives inside this VEX code. Attributes require “@” notation, variables do not.

“target” lives on my geo ? As in it's always available ?
【T】【C】【S】
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
if
vector target = {0,0,0};
is in a vex code “window” it's always available within that window, but only there.

v@target = {0,0,0};
is available both within the vex “window” and outside it, alhtough it now must be prefaced with the @ symbol and possibly additional code depending on where your using it.

For all intents and purposes you can consider target a variable which ever way you create it.
Edited by BabaJ - Dec. 13, 2016 22:50:32
User Avatar
Member
767 posts
Joined: April 2014
Offline
That helps
Is there a float alternative to the function findAttributeCount ?
【T】【C】【S】
User Avatar
Member
459 posts
Joined: Oct. 2011
Offline
That wouldn't make sense. The number of elements with a certain value should never be a float. “2.7286 number elements has the value N”. Get it?

-b
Edited by bonsak - Dec. 14, 2016 03:09:41
http://www.racecar.no [www.racecar.no]
User Avatar
Member
767 posts
Joined: April 2014
Offline
I understand, but I'm getting the results I want to a degree when adjusting the ramp that previously I wasn't all because I removed the ceiling function. I can't figure out how to fix this without re-inserting the ceiling function ?
【T】【C】【S】
  • Quick Links