Cross product

Started by mogn, May 18, 2011, 12:12:31 PM

Previous topic - Next topic

mogn

According to http://tutorial.math.lamar.edu/Classes/CalcII/CrossProduct.aspx
the cross product of the vectors [3, 92, 7] and [5, 146, 11] can be calculated to [-10, 2, -22]
according to the following sceme:

    i     j     k    i    j
    3   92    7   3   92
    5, 146   11  5  146

    i = 92*11 - 7*146 = -10  (co-determinant of i)
    j = 7*5 - 3*11     =    2   (co-determinatno of j)
    k = 3*146 - 92*5  = -22  (co-determinant of k)

    i.e "Cross product"([3, 92, 7], [5, 146, 11]) = [-10, 2, -22]

However tg2 returns [282, -8, -22] ?

Matt

How did you test this?
Just because milk is white doesn't mean that clouds are made of milk.

mogn

I made a displacement in the terrain, made a new wiev of the displacement., assigned this to a get x, get y or get z of
the cross product, and read the displacement in the wiev window.
I have repeated the experiment with a simple cross product of two vectors, giving the correct result.
So this error is not a fault of tg2, but must be my fault. Sorry.
When I repeat the the result with a displacement outside the terrain and a new wiev, this gives no
meaningful result?

Matt

Quote from: mogn on May 18, 2011, 01:09:31 PM
I made a displacement in the terrain, made a new wiev of the displacement., assigned this to a get x, get y or get z of
the cross product, and read the displacement in the wiev window.
I have repeated the experiment with a simple cross product of two vectors, giving the correct result.
So this error is not a fault of tg2, but must be my fault. Sorry.

Glad that's working as expected.

Quote
When I repeat the the result with a displacement outside the terrain and a new wiev, this gives no
meaningful result?

I'm sorry, I'm not sure what you mean.
Just because milk is white doesn't mean that clouds are made of milk.

mogn

When I'am testing values, I used to to connect the node generating the value to right input of of a local displacement node,
and displying a new view of the small window, the y-value then gives the value. Since the small previev no longer exist,
I cant use this method any longer.
(a view value node would be a nice thing to have)

jo

Hi mogn,

Quote from: mogn on May 20, 2011, 04:31:19 AM
When I'am testing values, I used to to connect the node generating the value to right input of of a local displacement node,
and displying a new view of the small window, the y-value then gives the value. Since the small previev no longer exist,
I cant use this method any longer.
(a view value node would be a nice thing to have)

This is exactly what the Notifier node in Functions > Debug is for:

http://forums.planetside.co.uk/index.php?topic=4454.new

The easiest way to use it (since the preview behaviour change) is to open a shader preview for the Notifier node, using the preview button in the param view. I think the best way to view values on Windows is to start tgdcli and use the console option to output Notifier messages to the console.

I've actually just written a node which gives live value readouts in the node's param view, in fact I used it to verify the cross product node was working correctly. It will be available in a future release.

Regards,

Jo

Tangled-Universe

Hi Jo,

Coincidentially I've been trying to use both 2 nodes yesterday to see how I could check Mogn's math and somehow I can't get them to work.
I also find them way too technical and the opposite of straight-forward (what's that in english?).

Could you assemble an example setup where an operation like Mogn performs here outputs something?

Ideally I'd like this node to show the values/readout inside the node parameter view which allows to use the "stay open" feature so you can follow it live.
E.g. feed the cross-product output to the vector input of the debug node, open the debug node and in the vector text field you see the current value/result of that cross-product.

Cheers,
Martin

jo

Hi Martin,

Quote from: Tangled-Universe on May 20, 2011, 06:02:00 AM
Coincidentially I've been trying to use both 2 nodes yesterday to see how I could check Mogn's math and somehow I can't get them to work.
I also find them way too technical and the opposite of straight-forward (what's that in english?).

That's fine in English :-). If you have concerns about the usability of the Notifier node it's ok to discuss them here but if you also mean the Live value display node in the alpha you should bring that up in the alpha forums. That's a very new node and I'm happy to hear feedback about it - as with the Notifier node really.

Quote
Could you assemble an example setup where an operation like Mogn performs here outputs something?

See the attached project. There are instructions in the Note node, but basically load the file using tgdcli, open the Notifier 01 param view and then open a shader preview for it. You'll need to use tgdcli to see the messages in the console.

Quote
Ideally I'd like this node to show the values/readout inside the node parameter view which allows to use the "stay open" feature so you can follow it live.
E.g. feed the cross-product output to the vector input of the debug node, open the debug node and in the vector text field you see the current value/result of that cross-product.

That's what the Live value display node in the alpha does. The catch is you need a shader preview open for the node to see the results, if you haven't got the node hooked into the main network. This is required because it's the rendering process which drives the flow of data through the network. The debug nodes kind of catch the data as it flows past and displays it. I need to talk with Matt about the possibility of sending a "pulse" through the network to manually generate data.

The Live value display node is simpler than the Notifier node in that it doesn't have any formatting options.

Regards,

Jo

Tangled-Universe

Hi Jo,

Thanks for the very good explanation and the example.
Didn't know the rendering process is necessary to make it work, but it does make sense.

Regards,
Martin