GithubHelp home page GithubHelp logo

krt's Introduction

krt

The Korn shell RayTracer

Contents

  1. Synopsis
  2. Install
  3. Tests
  4. Contributing
  5. License

Synopsis

krt [-s sqrt] [-n nearest]

krt is the beginning of a raytracer written in pure shell. There is actually nothing particularly korny about it, this is just a reference to my other project kbf. It is currently compatible with ksh and bash, and probably with any shell implementing the local keyword.

The option -s allows to select among three algorithms to calculate the square root of a given number: heron, newton and bakhshali. All three are implemented in sqrt.sh. The default algorithm is newton and was picked at random.

The option -n allows to select two methods of finding the nearest approximation of square root: dynamic and fixed. The first method, dynamic, is extremely slow and should not be used. The second, fixed, is the default but required a pre-generated list of squares named perfect_squares.txt.

Such a list can be generated beforehand using this helper script:

$ perfect_squares.sh > perfect_squares.txt

For now there are no scene, no floor, no lights, just a hanging red sphere on a blue background. This is the same as section 5 of Ray Tracing in One Weekend.

Here it is:

Blue background and red sphere

It took my laptop 47 minutes to generate it.

Install

Requires

  • Any a-bit-more-than-POSIX shell.

Build

There is a makefile available, just run make. Note that there are no install rule.

Contributing

Either send send GitHub pull requests or send patches on SourceHut.

License

All the code is licensed under the ISC License.

krt's People

Contributors

tleguern avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.