Can I set up arrays that only contain points?


Continuing the discussion from Problem adding polygon to mesh - again:

No, John, you cannot do this because Ruby is a “weakly typed language” and 100% object oriented, meaning that every identifier in Ruby is a reference that can point at any object, of any class (type), at any time,… and can be **re-**referenced at any time, to point at any other object, of any class (type.)

But you can create wrapper collection classes that control what classes of objects are allowed to be inserted in the collection.

For now, you can use method Array#map! to convert an array of arrays, to an array of points:! {|a| Geom::Point3d::new(a[0..2]) }

EDIT: Added a subrange to the Geom::Point3d constructor argument to prevent ArgumentError when arrays are more than 3 elements.

Problem adding polygon to mesh - again