Fix #115907: Select similar edge direction skips opposite direction #115951

Merged
Philipp Oeser merged 1 commits from lichtwerk/blender:115907 into main 2023-12-13 10:30:59 +01:00
Member

As I dont quite get the logic of "enforcing a positive quadrant" from
b38be90515 (which broke the previous behavior of 2.79 which was
capable of handling reversed edges as well -- there might be ways to
make that work though), now use the alternative approach of storing the
flipped direction in the kdtree as well.

This has a slight performance hit (only noticable at ~500k edges), but I
believe correctness beats performance here.

As I dont quite get the logic of "enforcing a positive quadrant" from b38be905154b (which broke the previous behavior of 2.79 which was capable of handling reversed edges as well -- there might be ways to make that work though), now use the alternative approach of storing the flipped direction in the kdtree as well. This has a slight performance hit (only noticable at ~500k edges), but I believe correctness beats performance here.
Philipp Oeser added 1 commit 2023-12-08 18:02:27 +01:00
139be8cfff Fix #115907: Select similar edge direction skips opposite direction
As I dont quite get the logic of "enforcing a positive quadrant" from
b38be90515 (which broke the previous behavior of 2.79 which was
capable of handling reversed edges as well -- there might be ways to
make that work though), now use the alternative approach of storing the
flipped direction in the kdtree as well.

This has a slight performance hit (only noticable at ~500k edges), but I
believe correctness beats performance here.
Philipp Oeser added this to the Modeling project 2023-12-08 18:02:38 +01:00
Philipp Oeser requested review from Dalai Felinto 2023-12-08 18:02:47 +01:00
Philipp Oeser requested review from Campbell Barton 2023-12-08 18:02:54 +01:00
Campbell Barton approved these changes 2023-12-13 05:39:35 +01:00
Philipp Oeser merged commit 105db1a06e into main 2023-12-13 10:30:59 +01:00
Philipp Oeser deleted branch 115907 2023-12-13 10:31:03 +01:00

I think I understand the idea of "enforcing a positive quadrant".
The objective was apparently to reverse direction if the direction was pointing in a "negative quadrant".
The inversion happened in this order:
[0, 0, -1] -> [0, 0, 1]
[0, -1, 0] -> [0, 1, 0]
[-1, 0, 0] -> [1, 0, 0]

This solution tried to avoid doubling the number of items in KDTree.
It seems advantageous, but we can notice a problem with it. For example, if we compare the vectors [1, 1, 0.001] and [1, 1, -0.001].
According to the algorithm, [1, 1, -0.001] would be inverted and become [-1, -1, 0.001].
As a result, pairs that previously matched no longer do.

If we want to keep the KDTree smaller, I think we could continue using the previous solution, but check the largest axis before inverting.

I think I understand the idea of "enforcing a positive quadrant". The objective was apparently to reverse direction if the direction was pointing in a "negative quadrant". The inversion happened in this order: [0, 0, -1] -> [0, 0, 1] [0, -1, 0] -> [0, 1, 0] [-1, 0, 0] -> [1, 0, 0] This solution tried to avoid doubling the number of items in KDTree. It seems advantageous, but we can notice a problem with it. For example, if we compare the vectors [1, 1, 0.001] and [1, 1, -0.001]. According to the algorithm, [1, 1, -0.001] would be inverted and become [-1, -1, 0.001]. As a result, pairs that previously matched no longer do. If we want to keep the KDTree smaller, I think we could continue using the previous solution, but check the largest axis before inverting.

On second thought, checking the largest axis won't work either.
It would fail in this case:
[-0.5001, 0.5, 0.5]
[-0.5, 0.5001, 0.5]

On second thought, checking the largest axis won't work either. It would fail in this case: [-0.5001, 0.5, 0.5] [-0.5, 0.5001, 0.5]
Author
Member

Thx checking @mano-wii

If you come up with something that works (without doubling the number of items in KDTree), please let me know.

Thx checking @mano-wii If you come up with something that works (without doubling the number of items in KDTree), please let me know.

It seems really impossible to choose a single "positive" direction to find reliable matches and avoid doubling the KDTree.
But for performance, it might be worth trying a non-doubling solution.
The solution I thought of would be to put all components as positive: [abs(x), abs(y), abs(z)]. After finding the matches, a second test can be done with the few results obtained.

(But it doesn't really take priority. Performance when searching for similarity doesn't seem to be an issue currently).

It seems really impossible to choose a single "positive" direction to find reliable matches and avoid doubling the KDTree. But for performance, it might be worth trying a non-doubling solution. The solution I thought of would be to put all components as positive: [abs(x), abs(y), abs(z)]. After finding the matches, a second test can be done with the few results obtained. (But it doesn't really take priority. Performance when searching for similarity doesn't seem to be an issue currently).
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#115951
No description provided.