repository

8 views
Skip to first unread message

jelle

unread,
Nov 9, 2010, 9:06:53 AM11/9/10
to python-radiance
To structure python-radiance, is it an interesting idea to commit what
you are willing to share what is already written?
Personally I think that's preferable to starting from scratch, but
rather go with the more pragmatic approach of integrating code that is
already there. For sure that does not mean accepting all what is out
there, but rather selecting those bits that are well written /
structured and worth elaborating on. This initial commit of code to
the repository is a indexing / reviewing phase of code of different
individuals, forming a base for discussion.

Thomas Bleicher

unread,
Nov 9, 2010, 10:08:54 AM11/9/10
to python-...@googlegroups.com
On Tue, Nov 9, 2010 at 9:06 AM, jelle <jellef...@gmail.com> wrote:
> To structure python-radiance, is it an interesting idea to commit what
> you are willing to share what is already written?

Oh! Hold the horses!

Although I'm all for reusing already written stuff we should not
happily go ahead and check in everything we have. That's going
to pollute the repository in no time. If we are actually uploading
anything that is not tailored to fit into the p-r package it should
only go in a separate branch (let's call it "dump") from where
bits can be copied/merged into the "trunk" (sorry, don't know
what mercurial calls it yet).

First we need to discuss what the structure of the project should
look like. I was about to rip my projects apart and remove the
bits that are specific to my projects. What's left I will open
up for discussion of the implementation and concepts and if
those are along the lines of r-p and if they are Dave can check
them in.

I think that's a sensible way to consolidate all of our individual
efforts so far.

Thomas

jelle

unread,
Nov 9, 2010, 10:31:37 AM11/9/10
to python-radiance
> Although I'm all for reusing already written stuff we should not
> happily go ahead and check in everything we have.

Great!

> That's going to pollute the repository in no time.

The operative principal being; 1) collect 2) sort out what's
sufficiently coherent / well written / well structured 3) _then_ set
up the repository for development
google code has *great* tools for discussing / debating code, so that
will massively speed up the effort.
I *hate* endless discussion without action, that's all ;)

> If we are actually uploading
> anything that is not tailored to fit into the p-r package it should
> only go in a separate branch (let's call it "dump") from where
> bits can be copied/merged into the "trunk" (sorry, don't know
> what mercurial calls it yet).

Too complex.

> First we need to discuss what the structure of the project should
> look like.

What about a both bottom up and top down process simultaneously.
No need to re-invent the wheel.
I'm sure there's solid stuff out there, and yes, I'm curious to see
that.

> I was about to rip my projects apart and remove the
> bits that are specific to my projects.

Curious to be seeing that Thomas, looking fwd. glancing over that
code...

> I think that's a sensible way to consolidate all of our individual
> efforts so far.

With the great risk of not getting anything done and the maelstrom of
endless, boring design discussions ;)
Here's some ---ancient--- code I wrote a century ago:
http://www.jelleferinga.com/files/python-radiance/ ( right-click save
as... otherwise you get a 500 error... )

the primitives in rad_primitives.py are pretty well written and
perhaps worthy of a commit, perhaps the way of wrapping the radiance
exe's as suggested in rad_prog.py is interesting ( please focus on the
structure, not the implementation, that's seriously untested code ;)
What's cool about rad_primitives is that its trivial to write radiance
file using; just need the tri's and their indices, easy to bind it to
your preferred modeller.
load_hdr.py shows you how to load a .hdr file with the vips module.

-jelle

Thomas Bleicher

unread,
Nov 9, 2010, 2:22:14 PM11/9/10
to python-...@googlegroups.com
On Tue, Nov 9, 2010 at 10:31 AM, jelle <jellef...@gmail.com> wrote:

> Here's some ---ancient--- code I wrote a century ago:
> http://www.jelleferinga.com/files/python-radiance/  ( right-click save
> as... otherwise you get a 500 error... )

Can't get the *.py files. Only html decorated error messages. Sorry.

Thomas

rocketship

unread,
Nov 9, 2010, 2:53:02 PM11/9/10
to python-radiance
Somebody needs to write an API first - I would start with exposing the
basic functionality of Radiance in a way that is both Pythonic and
familiar to people who have used Radiance via shell commands. It'll
be easier to have people contribute if they are writing towards
something, and we'll end up with documentation.

Severn

Jelle Feringa

unread,
Nov 9, 2010, 4:33:21 PM11/9/10
to python-...@googlegroups.com

> Somebody needs to write an API first - I would start with exposing the
> basic functionality of Radiance in a way that is both Pythonic and
> familiar to people who have used Radiance via shell commands

Got a rough draft of that.
And would be happy to share that, such that we can use this to focus the discussion.
Saw the http://code.google.com/p/python-radiance/ repo, excellent!
Would it be useful to add this?

Also got a nice abstraction of radiance primitives ( materials, polygons, stuff like that ) which makes it easy to implement reading and writing to radiance data from other sources.
Here's an example of how I used this primitive API to export a mesh to radiance format by scripting Rhino from the COM API.
( Uh… this is from years ago… rhino5 will have python programming support ( and yes its cool ;) )
I use this with pythonocc in a similar manner.

from jf.rhino import loadBeta
from radiance.primitives import RadianceMesh # primitive polygon not get confused...

RS = loadBeta.RS; d1= loadBeta.d1; RF.Rsreg(RS)

def rhinoMeshToRadMesh(mshId, identifier, modifier, f=None, triangulate=True):
''' '''
assert RS.IsMesh(mshId)
if RS.MeshQuadCount(mshId) != 0 and triangulate:
print 'mesh has quads...'
mshId = RF.cmdTriangulate(mshId)

mshIndices = map(tuple, RS.MeshFaceVertices(mshId))
mshVerts = map(tuple, RS.MeshVertices(mshId))
# rhino uses 4 coords to encode a cell
# since we've triangulated the mesh anyhow

get_slice = lambda x: x.__getslice__(0,3)

mshIndices = map(get_slice, mshIndices)
mshVerts = map(get_slice, mshVerts)

# ---> these are the radiance primitives
rm = RadianceMesh('jelle', 'zulu')
rm.setIndices(mshIndices)
rm.setVerts(mshVerts)
return rm.write(f)
# ---> done writing radiance geometry...

mshId = RS.GetObject('ugh', 32)
print rhinoMeshToRadMesh(mshId, 'jelle', 'zulu')

Reply all
Reply to author
Forward
0 new messages