Transform texture using ruby
-
I'm new here and I can't decide whether this is a dev question or a newbie question - we'll see.
I want to model a 1st order icosahedral geodesic sphere (I'm using Gavin Kistner's Geodesic_SketchUp.rb) with one of two images on each face. There are two types of triangular faces, one, e, being equilateral, and, i, is isosceles. Each e gets the first image (with the appropriate rotational symmetry), and i gets the other image. The images appear to span more than one face in the finished product, but that is something I can deal with separately.
I am able (with the little ruby I have learned today) to apply material textures in Geodesic_SketchUp.rb, but I cannot position them properly. I have attached an icosahedron I did by hand, using the "pins" (only one type of face here), and the sketchup file.
How do I automate the positioning of the texture? Does that work for the isosceles triangles too?
edit: Should I look into the Image object and use the transparency to make the rectangle look triangular?
-
Since you are dealing with polyhedra that employ identical faces, you can reduce the workload by using components.
For the icosahedron, make each face a component, then rotate copies around the polyhedral axes.
For the 2v icosahedron, you have an equilateral triangle and an isosceles triangle making up each icosahedron face, as you note. Make each icosahedron face "cluster" a component. Within that component, make the equilateral triangle a component, and rotate/copy it into the isosceles triangle position. Scale that copy along its "height" axis, to make it isosceles. Rotate the isosceles copy equally (120°) around the center of the equilateral component; twice.
Of course, none of this is automatic, nor ruby-scripted. The methodology merely takes advantage of the similarities inherent to the polyhedra. When complete, you can change the texture for 1 component, and all of the copies will replicate your changes -- thereby, reducing your workload.If what I wrote doesn't make sense (yet,) examine the attached model, to see if it helps. You should be able to replicate the steps, AS LONG AS you know how to (1) rotate around any axis (by mouse-cursor dragging) and (2) can change the axes of a component so that the trianglular face is the primary face of the component. (This allows easy scaling of the equilateral into an iscosceles triangle.)
-Taff
-
Thank you Taff. I am an admirerer of your work!
I have so far modified Gavin's ruby script for this (mentioned above) and got it working, after figuring out how to fit the images onto the faces. I'll post my solution once I clean the code a little.
Advertisement