Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
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 903 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 EXPECT_NOT, kOOLogAllocationFailure, kOOMeshToOctreeConverterSmallDataCapacity, MAX, and OOLog.

◆ converterWithCapacity:

+ (instancetype) converterWithCapacity: (NSUInteger) capacity

Definition at line 903 of file OOMeshToOctreeConverter.m.

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

◆ dealloc

- (void) dealloc
implementation

Definition at line 903 of file OOMeshToOctreeConverter.m.

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

◆ descriptionComponents

- (NSString *) descriptionComponents
implementation

Definition at line 903 of file OOMeshToOctreeConverter.m.

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

◆ findOctreeToDepth:

- (Octree *) findOctreeToDepth: (NSUInteger) depth

Definition at line 903 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

◆ initWithCapacity:

- (id) initWithCapacity: (NSUInteger) capacity

Definition at line 903 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)

Member Data Documentation

◆ _data

- (struct OOMeshToOctreeConverterInternalData) OOMeshToOctreeConverter:
private

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