Oolite 1.91.0.7668-250429-8542c40
All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
OOMeshToOctreeConverter Class Reference

#include <OOMeshToOctreeConverter.h>

+ Inheritance diagram for OOMeshToOctreeConverter:
+ Collaboration diagram for OOMeshToOctreeConverter:

Classes

struct  OOMeshToOctreeConverterInternalData
 

Instance Methods

(id) - initWithCapacity:
 
(void) - addTriangle:
 
(Octree *) - findOctreeToDepth:
 
(void) - dealloc [implementation]
 
(NSString *) - descriptionComponents [implementation]
 

Class Methods

(instancetype) + converterWithCapacity:
 

Private Attributes

struct OOMeshToOctreeConverter::OOMeshToOctreeConverterInternalData _data
 

Detailed Description

Definition at line 41 of file OOMeshToOctreeConverter.h.

Method Documentation

◆ addTriangle:

- (void) addTriangle: (Triangle) tri

Definition at line 268 of file OOMeshToOctreeConverter.m.

268 :(Triangle)tri
269{
270 if (!OOTriangleIsDegenerate(tri))
271 {
272 AddTriangle(&_data, tri);
273 }
274}
OOINLINE void AddTriangle(GeometryData *data, Triangle tri)
struct OOMeshToOctreeConverter::OOMeshToOctreeConverterInternalData _data

References _data, and AddTriangle().

+ Here is the call graph for this function:

◆ converterWithCapacity:

+ (instancetype) converterWithCapacity: (NSUInteger) capacity

Definition at line 256 of file OOMeshToOctreeConverter.m.

256 :(NSUInteger)capacity
257{
258 return [[[self alloc] initWithCapacity:capacity] autorelease];
259}

◆ dealloc

- (void) dealloc
implementation

Definition at line 248 of file OOMeshToOctreeConverter.m.

249{
251
252 [super dealloc];
253}
OOINLINE void DestroyGeometryData(GeometryData *data)

References _data, dealloc, and DestroyGeometryData().

Referenced by dealloc.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ descriptionComponents

- (NSString *) descriptionComponents
implementation

Definition at line 262 of file OOMeshToOctreeConverter.m.

263{
264 return [NSString stringWithFormat:@"%u triangles", _data.count];
265}

References descriptionComponents.

Referenced by descriptionComponents.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findOctreeToDepth:

- (Octree *) findOctreeToDepth: (NSUInteger) depth

Definition at line 277 of file OOMeshToOctreeConverter.m.

277 :(NSUInteger)depth
278{
279 OOOctreeBuilder *builder = [[[OOOctreeBuilder alloc] init] autorelease];
280 OOScalar halfWidth = 0.5f + MaxDimensionFromOrigin(&_data); // pad out from geometry by a half meter
281
282 BuildSubOctree(&_data, builder, halfWidth, depth);
283
284 return [builder buildOctreeWithRadius:halfWidth];
285}
GLfloat OOScalar
Definition OOMaths.h:64
void BuildSubOctree(GeometryData *data, OOOctreeBuilder *builder, OOScalar halfWidth, NSUInteger depth)
static OOScalar MaxDimensionFromOrigin(GeometryData *data)
Octree * buildOctreeWithRadius:(GLfloat radius)
Definition Octree.m:856

References _data, OOOctreeBuilder::buildOctreeWithRadius:, BuildSubOctree(), and MaxDimensionFromOrigin().

+ Here is the call graph for this function:

◆ initWithCapacity:

- (id) initWithCapacity: (NSUInteger) capacity

Definition at line 234 of file OOMeshToOctreeConverter.m.

234 :(NSUInteger)capacity
235{
236 NSParameterAssert(capacity < UINT32_MAX);
237 if (capacity == 0) capacity = 1; // Happens for models with no faces.
238
239 if ((self = [super init]))
240 {
241 InitGeometryData(&_data, (uint_fast32_t)capacity);
242 }
243
244 return self;
245}
OOINLINE void InitGeometryData(GeometryData *data, uint_fast32_t capacity)

References _data, and InitGeometryData().

+ Here is the call graph for this function:

Member Data Documentation

◆ _data

- (struct OOMeshToOctreeConverterInternalData) OOMeshToOctreeConverter:
private

The documentation for this class was generated from the following files: