|
Post by signal11 on Jan 5, 2020 16:21:00 GMT
hi all !
in the 1st chapter, the 'negating tuples' section, it is advised that the final tuple will have each of it's 'x', 'y', 'z', 'w' components multiplied by a scalar (-1 for negation etc).
however, since 'w' indicates whether a tuple is a vector or a point, imho, during these operations, 'w' should be left untouched.
thanks !
|
|
|
Post by signal11 on Jan 6, 2020 12:49:16 GMT
Initially, I just followed the instructions blindly, and I was getting messed-up values for "w"... I'm pretty sure there is a case or two where you want to modify "w", but off the top of my head I can't think where it would be necessary. cool thanks ! for now, i am not touching 'w' component during scalar operations at all. let's see how it all goes.
|
|
|
Post by accolon on Jan 6, 2020 20:43:00 GMT
Some operations only make sense for vectors, e.g. negation or scalar multiplication. Since w is 0 for vectors, it doesn’t matter if you do anything with w. Indeed, it’s helpful to touch w and check its value afterwards — if it ever becomes something different than 0, you performed an undefined operation.
|
|
|
Post by signal11 on Jan 7, 2020 4:48:36 GMT
Some operations only make sense for vectors, e.g. negation or scalar multiplication. Since w is 0 for vectors, it doesn’t matter if you do anything with w. Indeed, it’s helpful to touch w and check its value afterwards — if it ever becomes something different than 0, you performed an undefined operation. yup indeed, for these operations, i am currently throwing std::domain_error(...) exception, similarly for some combinations of 'operator+=(...)' and 'operator-=(...)' as well.
|
|