I've got the new 3-d rendering system online, rendering, and exporting images. The image shown here was built using the code below
The first three lines of this code are the basic bootstrapping. We put two locations in space. We build out structure seed from that. I then define a display property to be able to highlight one of the spans. Then, the first two 'add joint' commands are using the 2D building ability. When building an object from only two points, I have to make up a third one in order to define what plane the new point should be in. I also need to say 'far' or 'near' relative to the made-up point that defines the plane since there are usually two possible solution points. The last 'add joint' is a regular 3D joint, made from three of the other joints.
You might notice that we constructed this pyramid without all of the pieces. In designing machines, this will actually be a valuable feature since it prevents you from making machines that *can* bind. This way, you must make models that are minimally determined and thus maximally able to move when their joints move.
nearL = location(0,0,0)
nearR = location(1,0,0)
s = structureSeed(nearL,nearR)
highlightDisProp = displayProperties([100,100,255],7)
farL = s.addJoint(nearL,1,nearR,math.sqrt(2),location(0,0,1),'f')
farR = s.addJoint(nearL,math.sqrt(2),nearR,1,location(0,0,1),'f')
top = s.addJoint(nearL,1,nearR,1,farL,1,dispPropA=highlightDisProp)
Lastly, I've uploaded the code for this. It requires both pygame and imagemagick (just to apt-get installs on them). Run the command 'python main.py' to make it do it's thing.
https://docs.google.com/open?id=0B1S9HNoTaV32Y20wRjVhNzBfd0U
No comments:
Post a Comment