vapory icon indicating copy to clipboard operation
vapory copied to clipboard

Isosurface

Open luwenRGB opened this issue 10 years ago • 1 comments

Hi!

Congrast on this amazing package!

I would like to ask if "isosurface" (and how to input functions) is available in vapory. I would like to work with different functions, like in this example:

http://home.online.no/~t-o-k/POV-Ray/Isosurface-Sombrero.txt

Thanks a lot!

luwenRGB avatar Feb 08 '15 19:02 luwenRGB

I recently worked with Isosurfaces in vapory.

First, you need to modify the vapory/vapory.py file from the library to include the following lines at the bottom:

class Isosurface(POVRayElement):
    """ Isosurface()"""

class Function(POVRayElement):
    """ Function()"""

Then reinstall the library using python setup.py install like usual.

Here's an example of how I was using Isosurfaces and Functions. As far as I'm aware there's no idiomatic way (or vapory library function) to turn a python function into a vapory function, so for the moment we have to write the function in a normal python string.

def get_isosurface(t):
    """get the povray isosurface at time t"""
    DIM = 30
    function = "y + cos(0.6 * sqrt((x - 5) * (x - 5) + z * z) + 2 * pi * " + str(t) + ") + cos(0.6 * sqrt((x + 5) * (x + 5) + z * z) + 2 * pi * " + str(t) + ")"
    return Isosurface(
            Function(function),
            ContainedBy(Box(-DIM, DIM)))

reuk avatar Aug 24 '15 17:08 reuk