4 ms·
Does anyone have examples of use to share?
by Bootvis 7y ago
Does anyone have examples of use to share?
- imglorp 7y agoThe .inp files in the qa directory seem to be the only samples. The user guide looks mostly reference. Note to anyone posting a new language experiment: samples are critical! https://github.com/gregfjohnson/aplette/blob/master/qa/printing.inp https://github.com/gregfjohnson/aplette/blob/master/qa/print...
- jetti 7y agoI would like to add that keeping samples up to date is important too. In the early days there may be breaking changes, I should always be able to run the samples with the latest version of the language and not get any errors or end up with unexpected behavior.
- gregfjohnson 7y agoOver the weekend I was trying to figure out the perspective transformation in a 3D graphics package (THREE.js). 3D graphics involves a lot of matrix algebra, and so is ideal for APL. Here is an aplette function for creating a perspective matrix: G m { gfx parms; left; right; bottom; top; near; far left { parms[1] right { parms[2] bottom { parms[3] top { parms[4] near { parms[5] far { parms[6] m { 4 4R0 m[1;1] { 2 X near % (right-left) m[1;3] { (right + left) % (right - left) m[2;2] { 2 X near % (top-bottom) m[2;3] { (top + bottom) % (top - bottom) m[3;3] { -(far + near) % (far - near) m[3;4] { -2 X far X near % (far - near) m[4;3] { `1 )read gfx m { gfx `10 10 `10 10 2 1000 8 4 J@N m 0.2000 0.0000 0.0000 0.0000 0.0000 0.2000 0.0000 0.0000 0.0000 0.0000 `1.0040 `4.0080 0.0000 0.0000 `1.0000 0.0000 8 4 J@N %@L m 5.0000 0.0000 0.0000 0.0000 0.0000 5.0000 0.0000 0.0000 0.0000 0.0000 0.0000 `1.0000 0.0000 0.0000 `0.2495 0.2505