Remix.run Logo
emil-lp a day ago

You mean inside the resulting rectangle?

That's what the article suggests.

aaronblohowiak a day ago | parent [-]

no, this person is not suggesting a parallelogram but rather performing an affine transformation on the triangle to make it a right triangle so they can pick a random point in a square instead. as another commenter mentioned, I believe this distorts the distribution and won't do the right thing.

creata a day ago | parent | next [-]

https://en.wikipedia.org/wiki/Probability_density_function#V...

Affine transformations just scale the probability density by a constant, so a uniform distribution is still uniform.

aaronblohowiak a day ago | parent [-]

ah, excellent point. thanks. this works if they are transforming the triangle to be a right triangle to make a rectangle but if they are making it half a square, that could not be accomplished solely with affine transformations (if I figure correctly...)

cluckindan 18 hours ago | parent [-]

But you can just map one right triangle to the other without affecting the distribution.

o11c a day ago | parent | prev [-]

There's no distortion for the purposes of randomness (there would be if you cared about distance between specific points before/after the transformation), but the blog article fails to actually explain the method.

Clicking through to SO explains it (but assumes you can read numpy). The `s * u` and `t * v` (where `u` and `v` are vectors) are the transformation from right-triangle (half of square) to triangle (half of parallelgram).

saltcured a day ago | parent [-]

Hmm, is this "car(ing) about distance between specific points" something that would matter if we were going to operate in reverse and splat something at each point to render the triangle?

I think that sort of splatting is how I intuitively think about this problem, and likely where I went wrong in thinking there would be a distortion of the density function. I'm not confident whether this actually matters though. Would it still approximate the same distribution regardless of what splat shape is used...?