### Home Classes Methods

### In Files

- lib/constraints.rb

### Parent

Object

### Methods

- ::new
- #cover_point?
- #erase

### Files

- LessThan5BlueLabels.txt
- AtLeast2LargeSegments.txt

### Class Index

Quicksearch

- AddLabelTool
- AllRulesAppliedGoal
- Area
- AreaConstraint
- Array
- BalancedBinaryTree
- BalancedBinaryTreeNode
- CloseObserver
- Constants
- Constraint
- CurrentLabelledShape
- DistinctShapeConstraint
- Execution
- Goal
- Grammar
- Label
- LabelledShape
- LineDescriptor
- LinearLinkedList
- LinearLinkedListNode
- NoLabelsGoal
- NoMoreRulesGoal
- NoScalesConstraint
- Numeric
- Object
- OrderedPoint
- PiList
- Point
- Project
- Robot
- Rule
- RuleGroupsObserver
- RuleLabelledShape
- RuleShapeObserver
- Segment
- ShaDeLayersObserver
- Shade
- ShadeUtils
- UndoObserver

No matching classes.

# Area

Author | Manuela Ruiz (mruiz@lcc.uma.es)

An abstract representation of an area

### Public Class Methods

new(points, color_name=Constants::COLOR_AREA) click to toggle source

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

### Public Instance Methods

cover_point?(point) click to toggle source

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

erase() click to toggle source

Deletes the area

         # File lib/constraints.rb, line 116
    116:         def erase()

    117:                 entities = Sketchup.active_model.entities

    118:                 @group.locked = false

    119:                 entities.erase_entities @group

    120:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.