math - how to define n-dimensional vector rotation and reflection in haskell? -
how define vector rotation , reflection in general function work in n dimensions in haskell?
currently have dot product, normalization , projection done stuck on reflection , rotation.
data vector s = vector {len::s,arr::a} normalize :: vector s → vector s normalize = tovector . uncurry (zipwith (/)) . (id&&&(repeat . sqrt . sum . map (^2))) . fromvector dot :: vector s → vector s → dot v = sum ∘ zipwith (*) (fromvector v) ∘ fromvector project :: vector s → vector s → vector s project v = tovector ∘ uncurry (zipwith (*)) ∘ (fromvector&&&(repeat ∘ (v`dot`)))
i've been searhing days seems using haskell understand mathematics can cause problems when there no clear code (or no code @ all) , tutorials on n-dimensional vectors go past knowledge in mathematics.
regarding mathematical aspects of n-dimensional rotations, might recommend publications of andrew j. hanson of computer science department of university of indiana. in particular:
“rotations n-dimensional computer graphics” https://www.cs.indiana.edu/pub/techreports/tr406.pdf
that paper successor “geometry n-dimensional computer graphics” https://classes.soe.ucsc.edu/cmps161/winter14/papers/pv/ggndgeom.pdf
the mathematics require knowledge of vector arithmetic , linear algebra, if you’re going performing n-dimensional transformations, recommended way math.
Comments
Post a Comment