def mainR(): ''' Test to demonstrate reading an obj file and using clones ''' from PyRatObjParser import PyRatObjParser from PyRatClone import PyRatClone from PyRatBox import test import sys if len(sys.argv) > 1: filename = sys.argv[1] else: filename = 'tests/clone2.obj' filename = 'tests/new_plant.obj' hasGL = False world = PyRatObjParser(filename, verbose=True, GL=True) if world.root.size == 0: world.error('Zero size in world root') return False world.root.planes = world.infinitePlane info = {'verbose': True} name = str(globals()['__file__'].split('/')[-1].split('.')[0]) test(np.zeros(3), np.zeros(3), obj=world.root, info=info, type=name, nAtTime=100 * 100 / 20, name=name[5:]) return True
def main(): ''' A simple test of the Spheroid algorithm A scan over a Spheroid is made and an image produced tests/PyRatSpheroid-near.png with the distances. It should be ~1 in the centre (since the camera is located at z=4) but this is a volumetric example. ''' import sys import os from PyRatRay import PyRatRay import pylab as plt from PyRatBox import test base = np.array([0, 0, 0.]) radius = 1.0 info = {'verbose': True} #,'lad':3.0} name = str(globals()['__file__'].split('/')[-1].split('.')[0]) test(base, radius, info=info, type=name, name=name[5:])
def mainR(): ''' Test to demonstrate reading an obj file and using clones ''' from PyRatObjParser import PyRatObjParser from PyRatClone import PyRatClone from PyRatBox import test import sys if len(sys.argv) > 1: filename = sys.argv[1] else: filename = 'tests/clone2.obj' filename = 'tests/new_plant.obj' hasGL = False world = PyRatObjParser(filename,verbose=True,GL=True) if world.root.size == 0: world.error('Zero size in world root') return False world.root.planes = world.infinitePlane info = {'verbose':True} name = str(globals()['__file__'].split('/')[-1].split('.')[0]) test(np.zeros(3),np.zeros(3),obj=world.root,info=info,type=name,nAtTime=100*100/20,name=name[5:]) return True
def main(): ''' A simple test of the Spheroid algorithm A scan over a Spheroid is made and an image produced tests/PyRatSpheroid-near.png with the distances. It should be ~1 in the centre (since the camera is located at z=4) but this is a volumetric example. ''' import sys import os from PyRatRay import PyRatRay import pylab as plt from PyRatBox import test base = np.array([0,0,0.]) radius = 1.0 info = {'verbose':True}#,'lad':3.0} name = str(globals()['__file__'].split('/')[-1].split('.')[0]) test(base,radius,info=info,type=name,name=name[5:])
def main(): ''' A simple test of the cylinder algorithm A scan over a cylinder is made and an image produced tests/PyRatCylinder-near.png and tests/PyRatCylinder-far.png with the distances. It should be close to 1 at the nearest point (since the camera is located at z=2) for the near intersection and 2.0 for the far. ''' # set up a test object: a facet from PyRatBox import test base = np.array([-0.5,1.,0.]) tip = np.array([0.,0.,3.0]) info = {'verbose':True,'radius':0.5,'caps':True} name = str(globals()['__file__'].split('/')[-1].split('.')[0]) test(base,tip,info=info,type=name,name=name[5:])
def main(): ''' A simple test of the cylinder algorithm A scan over a cylinder is made and an image produced tests/PyRatCylinder-near.png and tests/PyRatCylinder-far.png with the distances. It should be close to 1 at the nearest point (since the camera is located at z=2) for the near intersection and 2.0 for the far. ''' # set up a test object: a facet from PyRatBox import test base = np.array([-0.5, 1., 0.]) tip = np.array([0., 0., 3.0]) info = {'verbose': True, 'radius': 0.5, 'caps': True} name = str(globals()['__file__'].split('/')[-1].split('.')[0]) test(base, tip, info=info, type=name, name=name[5:])
def main(): ''' A simple test of the Disk algorithm A scan over a disk is made and an image produced tests/PyRatDisk-near.png with the distances. It should be 1 in the centre (since the camera is located at z=4) ''' import sys import os from PyRatRay import PyRatRay import pylab as plt # set up a test object: a disk from PyRatBox import test base = np.array([0,0,1.]) normal = np.array([1,1,1.]) info = {'verbose':True,'radius':1.0} name = str(globals()['__file__'].split('/')[-1].split('.')[0]) test(base,normal,info=info,type=name,name=name[5:])
def main(): ''' A simple test of the Plane algorithm A scan over a Plane is made and an image produced tests/PyRatPlane-near.png with the distances. It should be 1 in the centre (since the camera is located at z=4) ''' import sys import os from PyRatRay import PyRatRay import pylab as plt from PyRatBox import test min = [0.,0.,3] normal = [1,1,1] info = {'verbose':True} name = str(globals()['__file__'].split('/')[-1].split('.')[0]) test(min,normal,info=info,type=name,name=name[5:])
def main(): ''' A simple test of the Disk algorithm A scan over a disk is made and an image produced tests/PyRatDisk-near.png with the distances. It should be 1 in the centre (since the camera is located at z=4) ''' import sys import os from PyRatRay import PyRatRay import pylab as plt # set up a test object: a disk from PyRatBox import test base = np.array([0, 0, 1.]) normal = np.array([1, 1, 1.]) info = {'verbose': True, 'radius': 1.0} name = str(globals()['__file__'].split('/')[-1].split('.')[0]) test(base, normal, info=info, type=name, name=name[5:])
def main(): ''' A simple test of the Plane algorithm A scan over a Plane is made and an image produced tests/PyRatPlane-near.png with the distances. It should be 1 in the centre (since the camera is located at z=4) ''' import sys import os from PyRatRay import PyRatRay import pylab as plt from PyRatBox import test min = [0., 0., 3] normal = [1, 1, 1] info = {'verbose': True} name = str(globals()['__file__'].split('/')[-1].split('.')[0]) test(min, normal, info=info, type=name, name=name[5:])
def main(): ''' A simple test of the Facet algorithm A scan over a disk is made and an image produced tests/PyRatFacet-near.png with the distances. It should be 1 in the centre (since the camera is located at z=4) ''' import sys import os import numpy as np from PyRatRay import PyRatRay import pylab as plt from PyRatFacet import PyRatFacet # set up a test object: a disk from PyRatBox import test vertices = np.array([[0,0,0.],[0,2,0],[2,0,-1]]) info = {'verbose':True} name = str(globals()['__file__'].split('/')[-1].split('.')[0]) test(vertices,None,info=info,type=name,name=name[5:])
def main(): ''' A simple test of the Facet algorithm A scan over a disk is made and an image produced tests/PyRatFacet-near.png with the distances. It should be 1 in the centre (since the camera is located at z=4) ''' import sys import os import numpy as np from PyRatRay import PyRatRay import pylab as plt from PyRatFacet import PyRatFacet # set up a test object: a disk from PyRatBox import test vertices = np.array([[0, 0, 0.], [0, 2, 0], [2, 0, -1]]) info = {'verbose': True} name = str(globals()['__file__'].split('/')[-1].split('.')[0]) test(vertices, None, info=info, type=name, name=name[5:])