Thanks a lot for the code Dan, I will definately test it!
Doing mostly JS for the past 6 months, is the good old for loop abandoned in Ruby ?
The code:
@unknownuser said:
You need to "absolutify" each index, in case any edges are hidden
Yeah, I noticed that. But it was a hard lesson learned.
I'm revisiting old code and I see some comments regarding abs performance issues.
So for some reason I used this. However you abs method looks slicker.
def self.positivVal(a)
a = a < 0 ? -a ; a
end
To further clarify, this concerns my parametric node modeler( long going project unfortunately )
It displays temporary geometry via the view draw class.
So I have to build compatible arrays or hashes not only for the PolygonMesh but also for the view draw methods in the update methods.
I've decided to build a solution for each node. So next node in "chain" that takes this polygonMesh as an input will have to be clone it.
I'm using this code for that
#Clone 1 mesh
def self.clone_polyMesh(mesh)
#Counts
npolys = mesh.count_polygons
#mesh
meshclone = Geom;;PolygonMesh.new( mesh.count_points, npolys )
for i in (1..npolys)
plps = mesh.polygon_points_at( i )
meshclone.add_polygon( plps )
end
meshclone
end
But your code looks more compact, so I might try that instead.
The question is if I have to build the polygons until the mesh is baked ?
Like the first code you posted Dan. For just adding points might be sufficient.
Keep the polygonMeshes with points only. And when it's time to bake build the polygons.
I might be overlooking something that must be done in the right context/scope....