Hacker News new | comments | ask | show | jobs | submit login
Heron Language 3D Geometry Demo (cdiggins.github.io)
29 points by cdiggins 9 months ago | hide | past | web | favorite | 8 comments

This came up just yesterday, but I wonder if Ohm (https://github.com/harc/ohm) would help with the implementation...

In case you are interested I actually used my own general purpose parsing library in TypeScript: https://github.com/cdiggins/myna-parser

I wish the syntax was more discoverable from this page. I see a sphere approximation, but no idea if it’s easy to produce from first principles or if it’s a primitive

Sorry it wasn't discoverable. The mesh, vector, and array library are built up from first principles. Take a look at: https://github.com/cdiggins/heron-language/tree/master/input

Probably the simplest thing is to link to the github repository "home page" with something like "Source on Github"...or even "source".

There's a link to https://github.com/cdiggins/heron-language/blob/master/input... on the demo page, where you can see that the sphere is implemented like this:

    // Given UV coordinates on the surface of a sphere u=[0,1), v=[0,1) computes the 3D location.
    function spherePoint(u, v)
        = vector(-cos(u*2.0*pi) * sin(v*2.0*pi), cos(v*2.0*pi), sin(u*2.0*pi) * sin(v*2.0*pi));

    function sphere(segments)
        = meshFromUV(spherePoint, segments);

    function sphere()
        = sphere(32);

Agreed. All languages ought to show a snippet of what they look like syntax-wise. Especially when page is showing the result like this.

For example, look at https://www.rust-lang.org/en-US/ or https://golang.org/. They both immediately give you a small taste of what the language looks like.

Good advice, thanks! I thought the link was enough, but I think showing the syntax right away will be very important.

Applications are open for YC Summer 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact