Code Monkey home page Code Monkey logo

3dmandel's Introduction

3D Mandelbot analogue

It all started with "there is no good 3D analogue of eth Mandelbrot". At some level, this is understandable, because the easiest way of seeing the 2D Mandelbrot iteration is as "squaring and adding" and a 3D vector multiplied by itself is, well, nothing.

But, not really happy with this, I started thinking about what "squaring" and "adding" actually meant, geometrically, in the complex space. Squaring (well, all multiplications) are simply "rotate and scale" and adding is simply translation.

With this in mind, I spent some more time thinking what would be needed. Specifically, we'd need a 3D transformation matrix, based on the "last step", followed by a translation (this being the point in 3D space that we're interested to see if it belongs to the set or not).

Translation

A translation is simple, just add the point/vector that is the result of the last transformation to the point we are checking for membership in the test.

Rotation and scaling

This is a bit more complicated. First, we define taht we're using a right-hand coordinate system. Then, we generate a transform matrix based on the previous poiint, the new point, and teh last transform.

  1. Align a transform matrix so its first ("X" axis) is the latest point.

  2. With this done, we can then define that we want the transform to be "in the XY plane" of the last translation. This, basically, means we take the cross-product of the previous point computed and the latest point computed. This gies uz the "Z" axis of out transform.

    However, we also want the next transform to be as close as possibel to the existing transform, so we also compute the negative of said Z axis, then pick the closes of Z and -Z as our new Z axis.

  3. We can then generate the remaining axis of our transform matrix as the cross-product of our X and Z axes.

  4. To get the scaling right, we then forcibly rescale the Y and Z axes to be the same length as the X axis.

3dmandel's People

Contributors

vatine avatar

Watchers

 avatar  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.