Sunday 15 April 2012

ruby - Algorithm for discretizing a surface -


My problem is in hand:

I have an arbitrary shape in the sketch and It is to check that one part of the surface is in the shadow and which part is exposed to the sun

My approach creates points on the surface and then checks whether there is any difference between the current state of each point and the Sun Whether there are obstructions or not, I should add that I have to know which issue will be in shadow In which direction the direct sun will be, that is, 30% of the surface is shaded, what I have to do, is not enough for it.

  1. Does anyone about the SketchUp's Ruby API tell me how to make points? I found the polygon mesh object which could be useful to me but could not get it to work.

  2. In return, the usual algorithm / should I read so that you can make points?

  3. Is there a better way to sketch or can I achieve what I want in general?

    Many thanks

    I made some progress is!

    An option is to make a point at the point of the center collective. For this I call regular polygon, that is where the corner is distributed evenly (like triangle or rectangular), coordinates for the center of mass

      x_com = average (vertices.x) ) Y_com = average (Vertices.y) z_com = average (vertices.z)   

    For more information see here:

    This is a creation of a large scale center Will allow to make the point, in this way:

      based on the average of X, Y, Z values, the mass of the polygon Find Center. # Mask Diff Centrefmas (Ephesus) mod = Center SketchUp. Active_model # Open Model Ent = Modestity # All models in the Model Model = FASS. DescriptionN = 0x = 0Y = 0G = 0Vertical | N + = 1x + = i.position [0] y + = i.position [1] z + = i.position [2]} pt = Geom :: Point3d.new (x / n, y / n, z / N) c = ent.add_cpoint pt end   

    From there, I could possibly draw a triangle by drawing a line in the root corner from the center of the public. Then repeat the process for the new triangle.

    It can work for some of the most regular shaped surfaces. I believe there can be problems with polygons, which have more irregular shaped polygons on one side, from one side to the other. Thin L-shaped surface

    Anyway, it seems that I've got a starting point.

No comments:

Post a Comment