# complements and negates

## Recommended Posts

I asked some of my instructors the other night about this and they were unable to answer me, but I was wondering if someone would be willing to give me an explanation of scenarios in which you might use a complement rather than a negate.  I know what the two different operations are but I was hoping someone might be able to give me an example not of what each do but why you would use one instead of the other.

##### Share on other sites

http://www.sidefx.com/docs/houdini14.0/nodes/vop/complement

http://www.sidefx.com/docs/houdini14.0/nodes/vop/negate

I think that explains it pretty well, no? They don't do the same thing so I don't know WHY I would use one over the other.

If I complement 0.65, I get 0.35 (1-0.65=0.35).

If I negate 0.65 I get -0.65 (0.65*-1).

##### Share on other sites

Region near a point is the first one I think of.

You have a null in space, you want to highlight points which are within a radius 1 of that null, white at the center, 0 at the edges (like a p_matte in nuke). You could use a distance vop to measure each point's distance from the null. Any points which sit directly on the null would have distance 0, and that number increases as the points get further away, ie its the reverse of what you want.

First instinct is to negate the value, but thats not right. 0 is still 0 at the center, and -1 at the edge, -2 when 2 units away, not quite right.

A compliment node gives you exactly what you want. Points with a distance of 0 become 1-0=1. Points of distance 1 become 1-1=0. Stick a clamp afterwards so negative numbers stay locked to 0, done.

You can do the same thing with combinations of negate and add an offset, compliment is just a handy shortcut function. Easier to understand when skimming a vop or shop network too.

## Create an account

Register a new account