File tree Expand file tree Collapse file tree 1 file changed +19
-17
lines changed
Expand file tree Collapse file tree 1 file changed +19
-17
lines changed Original file line number Diff line number Diff line change @@ -435,26 +435,28 @@ - (void)session:(ARSession *)session didUpdateFrame:(ARFrame *)frame {
435435 }
436436 }
437437 if (self.onFeaturesDetected ) {
438+ NSMutableArray * featurePoints = [NSMutableArray array ];
439+ for (int i = 0 ; i < frame.rawFeaturePoints .count ; i++) {
440+ vector_float3 point = frame.rawFeaturePoints .points [i];
441+
442+ NSString * pointId = [NSString stringWithFormat: @" featurepoint_%lld " ,frame.rawFeaturePoints.identifiers[i]];
443+
444+ [featurePoints addObject: @{
445+ @" x" : @(point[0 ]),
446+ @" y" : @(point[1 ]),
447+ @" z" : @(point[2 ]),
448+ @" id" :pointId,
449+ }];
450+
451+ }
438452 dispatch_async (dispatch_get_main_queue (), ^{
439453
440- NSMutableArray * featurePoints = [NSMutableArray array ];
441- for (int i = 0 ; i < frame.rawFeaturePoints .count ; i++) {
442- vector_float3 point = frame.rawFeaturePoints .points [i];
443-
444- NSString * pointId = [NSString stringWithFormat: @" featurepoint_%lld " ,frame.rawFeaturePoints.identifiers[i]];
445-
446- [featurePoints addObject: @{
447- @" x" : @(point[0 ]),
448- @" y" : @(point[1 ]),
449- @" z" : @(point[2 ]),
450- @" id" :pointId,
451- }];
452-
453- }
454454
455- self.onFeaturesDetected (@{
456- @" featurePoints" :featurePoints
457- });
455+ if (self.onFeaturesDetected ) {
456+ self.onFeaturesDetected (@{
457+ @" featurePoints" :featurePoints
458+ });
459+ }
458460 });
459461 }
460462}
You can’t perform that action at this time.
0 commit comments