# Radiance-general Digest, Vol 37, Issue 7

**URL:** <https://discourse.radiance-online.org/t/radiance-general-digest-vol-37-issue-7/2271>\
**Category:** radiance-general\
**Created:** [March 16, 2007, 3:22pm UTC](https://discourse.radiance-online.org/t/radiance-general-digest-vol-37-issue-7/2271 "2007-03-16T15:22:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jelle\_Feringa\_EZCT\_A](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/j/c67d28/32.png) [@Jelle\_Feringa\_EZCT\_A](https://discourse.radiance-online.org/u/Jelle_Feringa_EZCT_A)\
**Post date:** [March 16, 2007, 3:22pm UTC](https://discourse.radiance-online.org/t/radiance-general-digest-vol-37-issue-7/2271/1 "2007-03-16T15:22:22Z")

</div>

Hi Martin,

I agree with Francesco, (t)vtk is a good option, there is a powerful surface  
reconstruction method.  
[https://svn.enthought.com/enthought/wiki/](https://svn.enthought.com/enthought/wiki/)_TVTK_  
Something else you might want to look into is cgal's alpha-shapes.  
If you allow me for yet-another-python-plug:  
[http://cgal-python.gforge.inria.fr/](http://cgal-python.gforge.inria.fr/)  
implements this functionality:  
[http://www.cgal.org/Manual/3.2/doc\_html/cgal\_manual/Alpha\_shapes\_3/Chapter\_main.html](http://www.cgal.org/Manual/3.2/doc_html/cgal_manual/Alpha_shapes_3/Chapter_main.html)

Here's a tvtk snippet that might of some use:

> **···**
>
> ---------------------------------------------------------------------------------------------
> 
> import random  
> from pickle import loads  
> from pprint import pprint  
> from enthought.pyface import GUI
> 
> import numpy as np  
> import scipy as sp
> 
> from enthought.tvtk.tools import ivtk  
> from enthought.tvtk.api import tvtk  
> from enthought.pyface.tvtk import actors
> 
> gui = GUI()  
> window = ivtk.IVTKWithCrustAndBrowser(size=(800,600)) # Size is optional.  
> window.open()
> 
> # note that this data is generated with ALL rtrace output flags enabled!  
> f =  
> open('E:\\EZCT\\EZCT\_\_\_projects\\Seroussi\_House\\01\_Correspondance\\send\_program\_to\_marc\\rtrace\_values.pickle')  
> rtrace\_values = loads(f.read())
> 
> radiance\_origin = rtrace\_values[:,:3]  
> radiance\_direction = rtrace\_values[:,3:6]  
> radiance\_value = rtrace\_values[:,6:9]  
> radiance\_value = ((radiance\_value \* sp.array((0.265, 0.670,  
> 0.065),'f'))\*110.)/3683.  
> # -\> Lux conversion  
> radiance\_vec\_length = rtrace\_values[:,9:10]
> 
> radPts = tvtk.Points(data=radiance\_origin)  
> radPoly = tvtk.PolyData(points=radPts)  
> radPoly.point\_data.vectors = radiance\_direction  
> radPoly.point\_data.scalars = radiance\_value
> 
> reducedRadPts = tvtk.MaskPoints(input=radPoly, on\_ratio=10)  
> reducedRadPts.output.point\_data.vectors = radiance\_direction  
> reducedRadPts.output.point\_data.scalars = radiance\_value
> 
> thresh = tvtk.ThresholdPoints(input=radPoly)  
> thresh.threshold\_between(radiance\_value.mean(), radiance\_value.max())
> 
> ugrid = tvtk.UnstructuredGrid(points=radPts)
> 
> #srf = tvtk.ContourFilter(input=thresh.output)
> 
> srf = tvtk.SurfaceReconstructionFilter(input=thresh.output)
> 
> cf = tvtk.ContourFilter(input=srf.output)  
> cf.set\_value(0, 0.0)
> 
> srfMap = tvtk.PolyDataMapper(input=cf.output)  
> srfProp = tvtk.Property(representation='s')  
> srfActor= tvtk.Actor(mapper=srfMap, property=srfProp)  
> window.scene.add\_actor(srfActor)
> 
> ---------------------------------------------------------------------------------------------
> 
> from here use window.scene.(save\_obj?) to export the reconstructed surface  
> to a polygon file.
> 
> By the way, are you still working on top-down-lighting design approaches  
> Martin?  
> Very inspiring research!
> 
> -jelle
