Re: Howto model decoupled hierarchies?
- From: Lilburne <godzilla@xxxxxxxxxx>
- Date: Fri, 17 Nov 2006 12:36:59 +0000
Thomas Kowalski wrote:
Hello everyone,
I have a problem modeling the following and hope you could give me some
advice:
My program loads a file containing Points (ObjVertex) that are
structured like this:
Object -> vector<Slice> -> vector<Contour> -> vector<ObjVertex)
Looks similar to our slicing Picture class, which has sufficed for us for the last 20 years.
Using that input I shall construct the surface of the given object.
This happens iteratively for each neighboring pair of slices.
class SurfaceSector {
Slice & m_upperSlice;
Slice & m_lowerSlice;
}
Therefore a part (sector) of the surface is build between two
consecutive slices, which leads to the following hierarchy:
Surface -> vector<SurfaceSector> -> vector<Region> -> vector<Triangle>
During the calculation I create some structures (some of them temporary
during the calculation, some not) like new groups of points
(VertexGroups), convex hulls and vertex normals which don't fit into
this schema. Since some of the structures are per Slice or per Contour
I just added them to respective part of the Object, but since I want to
make have the Object read-only during the calculation this is not
possible anymore.
First determine what YOU mean by const. If what you are describing is some sort of annotation/cache that is during a calculation then make the annotation/cache mutable.
Elsewhere you talk about millions of vertices. I wouldn't have thought that std:vector was up to the job for that type of application. If you have any concerns about speed or memory usage you definitely don't want it resizing on you. With that in mind you're implimentation should avoid any gratuitous copy construction, or assignments particularly via temporaries. Making operator=() and copy-ctor() private helps here.
.
- References:
- Howto model decoupled hierarchies?
- From: Thomas Kowalski
- Howto model decoupled hierarchies?
- Prev by Date: Re: Design Pattern thoughts
- Next by Date: Re: Design Pattern thoughts
- Previous by thread: Re: How to model decoupled hierarchies?
- Next by thread: Re: Howto model decoupled hierarchies?
- Index(es):