Skip to content

Commit

Permalink
- Adds SCMeshingOperation, which allows you to create a connected mes…
Browse files Browse the repository at this point in the history
…h from a point cloud

- Fixes point cloud normals being flipped
  • Loading branch information
Aaron Thompson committed Feb 22, 2019
1 parent 4329000 commit d0480d8
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//
// SCMeshingOperation.h
// StandardCyborgFusion
//
// Copyright © 2019 Standard Cyborg. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

extern NSString * const SCMeshingAPIErrorDomain;

/**
Error codes within SCMeshingAPIErrorDomain
These are only reported for Standard Cyborg API usage
*/
typedef NS_ENUM(NSUInteger, SCMeshingAPIError) {
SCMeshingAPIErrorInvalidAPIKey = 1,
SCMeshingAPIErrorExceededMeshingCountLimit = 2
};


@interface SCMeshingOperation : NSOperation

- (instancetype)init NS_UNAVAILABLE;

- (instancetype)initWithInputPLYPath:(NSString *)inputPath
outputPLYPath:(NSString *)outputPath;

/**
Set this to be informed about the progress of the meshing operation.
@param progress From 0.0-1.0
*/
@property (nonatomic, copy) void (^progressHandler)(float progress);

/**
If non-nil, the error that occurred when performing this operation.
*/
@property (nonatomic, nullable) NSError *error;

#pragma mark - Tuning parameters

/**
The resolution of the reconstructed mesh vertices.
Higher values will result in more vertices per meshes,
and also take longer to reconstruct.
Range is 1-10, default is 5.
*/
@property (nonatomic) int resolution;

/**
The smoothness of the reconstructed mesh vertex positions.
Range is 1-10, default is 2.
*/
@property (nonatomic) int smoothness;

/**
The amount of surface trimming for low-density mesh regions.
Range is 0-10, default is 5. Higher numbers trim more away.
0 = don't trim.
*/
@property (nonatomic) int surfaceTrimmingAmount;

/**
If YES, attempts to build a closed mesh. Defaults to YES.
*/
@property (nonatomic) BOOL closed;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ FOUNDATION_EXPORT const unsigned char StandardCyborgFusionVersionString[];

#import <StandardCyborgFusion/CVPixelBufferHelpers.h>
#import <StandardCyborgFusion/SCAssimilatedFrameMetadata.h>
#import <StandardCyborgFusion/SCMeshingOperation.h>
#import <StandardCyborgFusion/SCPointCloud.h>
#import <StandardCyborgFusion/SCPointCloud+FileIO.h>
#import <StandardCyborgFusion/SCPointCloud+Metal.h>
Expand Down
Binary file modified StandardCyborgFusion/StandardCyborgFusion.framework/Info.plist
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ vertex ProjectedVertex RenderSCPointCloudVertex(Vertex v [[stage_in]],

float3 viewPosition = (uniforms->modelView * float4(v.position, 1)).xyz;
float3 normal = normalize(uniforms->normalMatrix * v.normal);
float pointSize = (normal.z < 0 && v.weight > 0.0) ? (uniforms->pointSize * fadeIn) : 0;
float pointSize = (normal.z > 0 && v.weight > 0.0) ? (uniforms->pointSize * fadeIn) : 0;

// Eye vector is implicitly at the origin since we're in view coordinates
float3 positionRelEye = normalize(viewPosition);
Expand Down

0 comments on commit d0480d8

Please sign in to comment.