SketchUcation Premium Membership

 

 

Adding geometry to model - speed issues

Re: Adding geometry to model - speed issues

Postby thomthom » Mon Nov 30, 2009 6:20 pm

I might have been a bit quick to judge the speed difference...
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: Adding geometry to model - speed issues

Postby Whaat » Mon Nov 30, 2009 7:11 pm

thomthom wrote:And I can't make out what the weld vertices do. I don't see any difference in what it produces.

Any performance increase when welding vertices?
Whaat
 
Posts: 966
Joined: Wed Nov 14, 2007 9:51 pm
Location: Saskatchewan, Canada
Name: Dale Martens
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: Adding geometry to model - speed issues

Postby thomthom » Mon Nov 30, 2009 7:52 pm

hm.. haven't tried too much with that right now. But I'm profiling a plugins right now. Might touch upon it later.

add_faces_from_mesh(polygonmesh)
TT_Teapot.create_teapot(16)
> Mesh generated in 11.35 seconds
Teapot with 16 segments generated in 13.201 seconds
#<Sketchup::Group:0xe9c9268>


fill_from_mesh(polygonmesh)
TT_Teapot.create_teapot(16)
> Mesh generated in 0.157 seconds
Teapot with 16 segments generated in 2.02 seconds
#<Sketchup::Group:0xe792a48>
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: Adding geometry to model - speed issues

Postby thomthom » Mon Nov 30, 2009 8:11 pm

I find no noticeable difference in speed when I change smoothing and/or welding.
And I still have no idea what welding vs not welding really do.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: Adding geometry to model - speed issues

Postby thomthom » Mon Nov 30, 2009 8:24 pm

polygonmesh.point_index(point) is slow

Found it faster to build a separate Hash to keep track of it as I added the points for the mesh.

While adding points
point_index = {}
p.each { |i|
point_index[i] = pm.add_point(i)
}


When collecting points to build polygon:
indexes = points.collect { |point| point_index[point] }
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: Adding geometry to model - speed issues

Postby toxicvoxel » Mon Nov 30, 2009 10:52 pm

I ran into the speed issue with realy large models and opted to write the geometry definition to a file format and then importing via a script - which gave me faster results, - but this may not suit your needs.
toxicvoxel
 
Posts: 366
Joined: Sun Dec 02, 2007 6:27 pm

Re: Adding geometry to model - speed issues

Postby TIG » Mon Nov 30, 2009 11:13 pm

I guess that 'welding' ensures that a vertex that shares a common position with another vertex is combined [welded] into just one vertex and you don't get the weirdness of two triangular faces leaking into each other as their actually common-vertex is taken as two separate vertices ?

The API is so rubbish on this that it could mean anything... but if I had designed this Method that's what it'd do ! :idea:
TIG
User avatar
TIG
Global Moderator
 
Posts: 13977
Joined: Mon Nov 12, 2007 7:24 pm
Location: Northumbria UK
Name: TIG
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: Adding geometry to model - speed issues

Postby thomthom » Mon Nov 30, 2009 11:25 pm

That's what I expected before I tested it. I thought each polygon would become a separated disconnected entity. But everything seems to merge regardless. The PolygonMesh class is a peculiar one.

But that fill method really helped me TIG. Thanks for pointing that one out! :thumb:
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: Adding geometry to model - speed issues

Postby TIG » Mon Nov 30, 2009 11:31 pm

I suspect that each triangular mesh is actually made as a separate shape BUT since the vertices and edges merge as the mesh is completed with more triangles they too disappear and the mesh 'meshes'... however, perhaps with very small [or large] dimensions perhaps the triangles are sufficiently separated and the vertices don't coincide within tolerances and the vertices aren't welded ? So perhaps the welded option takes a little more time but ensures a proper mesh ?

Someone went to the trouble to write this method but then decided not to explain what it does too well !!! :roll:
TIG
User avatar
TIG
Global Moderator
 
Posts: 13977
Joined: Mon Nov 12, 2007 7:24 pm
Location: Northumbria UK
Name: TIG
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: Adding geometry to model - speed issues

Postby thomthom » Mon Nov 30, 2009 11:34 pm

I hope Mr. Someone comes back and finished the job...
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17595
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Keyframe Animation plugin - animate your SketchUp model by adding movement to any object.

Premium Members get 20% discount!

Ad Machine
Robot
 
Posts: 2012

Previous

Return to Developers' Forum

Who is online

Users browsing this forum: Renderiza and 8 guests