I want to find a way to check if points(vectors) in my scene are contained within a SCNBox I have displayed on screen. Currently I have an array of about 83000 SCNVector3's. So far, I do this by simply running a for loop on each point and checking against the SCNBox bounding box. If it falls within that bounding box I save the point to a separate array. My goal however is not 1 bounding box. I further subdivide the bounding box into equal sections. For each of those I then have to check each individual point again to see if they fall into each one of those individual bounding boxes. If they do, I save those boxes so that when I go to subdivide them again, I am not subdividing boxes that contain no points. This helps performance a little bit as large sections of boxes that don't have points are not needlessly checked. This works okay for a small amount of boxes however I need to subdivide the boxes into much larger amounts, sometimes in the hundreds to thousands of boxes. As you can imagine, it takes a long time to check all the boxes. Currently I am having to iterate through all the points every time for each box. Is there a faster approach to this?
Finding a better method to identify points exist "inside" of a cube in swift
54 views Asked by 7ucci At
1
There are 1 answers
Related Questions in SWIFT
- Navigate after logged in with webservice
- URLSession requesting JSON array from server not working
- When using onDrag in SwiftUI on Mac how can I detect when the dragged object has been released anywhere?
- Protect OpenAI key using Firebase function
- How to correct error: "Cannot convert value of type 'MyType.Type' to expected argument type 'Binding<MyType>'"?
- How to share metadata of an audio url file to a WhatsApp conversation with friends
- Using @Bindable with a Observable type in SwiftUI
- How to make a scroll view of 9 images in a forEach loop open on image 6 if image 6 is clicked on from a grid?
- Using MTLPixelFormat.rgba16Float results in random round-off errors
- Search and highlight text of current text in PDFKit Swift
- How is passing a function as a parameter related to escaping autoclosure?
- Actionable notification api call not working in background
- Custom layout occupies all horizontal space
- Is it possible to fix slow CKAsset loading on Cloudkit?
- Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value - MapView.isMyLocationEnabled
Related Questions in SCENEKIT
- Create and customize T-shirt using SceneKit
- Multiple SCNActions
- How to Make Xcode Recognize Morph Targets in a DAE File Imported from Blender?
- ARKit combining ARImageAnchor position with offset values
- Fetching the animations added to a SCNNode
- RealityKit: VideoMaterial causing odd outline around transparent video?
- Can't add a SCNNode to the rootNode
- How to screenshot a SCNScene or SceneView?
- Issues with Vertical Stretching and Horizontal Movement in Metal Shading Language Ray Tracing Shader
- Why does AVPlayer doesn't orient video correctly when using SceneKit?
- How to load 3D model to UIView with better quality in iOS Swift?
- Several instances of 3D model with skinner, and duplication of weights/indices information
- SceneKit physicBody angularVelocity as local "body fixed" angular rates
- How to draw 3D circles/ring in RealityKit?
- SCNSkinner.boneIndices access generates GBytes of memory allocation - why?
Related Questions in SCNNODE
- How to get localCoordinates and localNormal of point of mesh(SCNNode) SCNCamera is looking at?
- Swift add custom geometry (view) to scnnode in SceneKit
- SceneKit - render surface normal of a geometry
- Swift Modify SCNode children
- Swift Prevent Scene point of view reset prior to Camera Action
- Execute function from SwiftUI view to view controller
- Performing gesture on view prevents camera action
- Detect touches and ignore other gestures Swift SceneKit
- Rotate and Move Camera around object does not work Swift SceneKit
- Swift - Detect Tap on child SCNNode not Parent
- Swift (SCNCamera) lock Globe rotation around axis
- Align SCNText Along SCNCylinder
- How to determine size of SCNPlane to cover entire SKScene
- How to run .fadeOut for mesh of the building without walls becoming semi-transparent during the animation? (SceneKit)
- How to Fix SCNNode Transform Problem with CABasicAnimation in SceneKit in Swift?
Related Questions in SCNSCENE
- Swift | RoomBuilder's RoomCaptureView export USDZ with blocks instead furniture
- How to screenshot a SCNScene or SceneView?
- How to move SCNNode within a SCNView using UITapGestureRecognizer?
- Swift-SceneKit-Can not load '.scn' file from 'art.scnassets'
- Placing SCNScene on the other SCNScene
- Finding a better method to identify points exist "inside" of a cube in swift
- SCNFloor goes unvisible randomly on SceneKit
- Changing scene view lighting model programmatically
- Get an URL from SCNScene
- Remove complete .scn instead of individual nodes Swift ARKit
- How to share .scn file as .usdz file?
- ARKit Project: Unexpectedly found nil while unwrapping an Optional value
- SwiftUI – Setting SceneView background to video
- arkit showPhysicsShapes larger than node
- How to scale SCNScene?
Related Questions in SCNVECTOR3
- Finding a better method to identify points exist "inside" of a cube in swift
- Place node in front of the camera and rotate
- Join Vector3 with BoxBuffer Geometry to make a proper angle join using Threejs
- Lat/Long to SCNVector3 for ARSCNView
- How to get the SCNVector3 position of the camera in relation to it's direction ARKit Swift
- Get World Coordinates of CGPoint in ARSCNView (Swift)
- Creating an array of SCNVector3 using Float in Swift
- Save value of SCNVector3 with UserDefaults in Swift
- Swift scene kit: move SCNNode to tap position?
- Convert CGPoint from a View to SCNVector3 in sceneKit
- Google Vision, use SceneKit to create face masks
- Detecting what coordinates I have selected within a displayed model .obj in iphone sdk
- How to detect if SCNBox was touched in scenekit?
- How to make SCNNode Position same for Child and Parent Nodes?
- How to Convert a SCNVector3 position to a CGPoint SCNView coordinate?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Your question says is there a better way, so using the physics engine would be a more 'standard' approach IMO, but performance wise I wouldn't know without trying it myself. It seems you either check manually, or let the physics engine check it for you.
Try this post - it's similar and there are some examples. [67575481].
The physics engine checks nodes for nodes and it may have changed since I did this, but I had to generate node names for my nodes and check it that way. There may be other options now.
My example is a moving 'missile' that collides with a moving node containing 'some monster', so I wasn't dealing with the size you are.
83000 vectors, dunno, that seems like a lot. You'll still have to do the checks you do now, just differently.
Hope that helps...