Author | Manuela Ruiz (mruiz@lcc.uma.es) |
An abstract representation of an area
points | array of points limitting the area |
color_name (optional): name of the color of the area to present
Initializing
# File lib/constraints.rb, line 82 82: def initialize(points, color_name=Constants::COLOR_AREA) 83: mesh = Geom::PolygonMesh.new 84: 85: mesh.add_polygon points 86: 87: entities = Sketchup.active_model.entities 88: 89: materials = Sketchup.active_model.materials 90: materials.add "area_material" 91: material = materials[materials.length-1] 92: material.color = color_name 93: material.alpha = Constants::ALPHA 94: @group = entities.add_group 95: @group.entities.add_faces_from_mesh(mesh, 0, material, material) 96: @group.locked = true 97: 98: # The face is the last entity added 99: # Trick to circumvent a SU error (add_faces_from_mesh returns 0 instead of the added faces) 100: size_entities = @group.entities.length 101: @face = @group.entities[size_entities-1] 102: end
point | a point |
Returns trye iff the area covers the point
# File lib/constraints.rb, line 107 107: def cover_point?(point) 108: result = false 109: if (@face.classify_point point) <= Sketchup::Face::PointOnEdge 110: result = true 111: end 112: return result 113: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.