korlibs / korlibs/korlibs-math-vector

KorMA shape ops producing inaccurate results when dealing with unit scales close to 0.001

Open
#4 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Kotlin
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

I made an Android app which uses KorMA to detect collision between polygons. On large scales (each unit corresponds to 1.0), it works fine, but when I get to smaller scales, it seems to break for some reason, even though the documentation doesn't mention anything in that regard.

Normal behaviour:

![image](https://user-images.githubusercontent.com/41439659/63654930-fbc5c500-c789-11e9-8401-1e475704289c.png)

Flawed behaviour examples (notice how it sometimes works on one side, but not the other):

![image](https://user-images.githubusercontent.com/41439659/63654940-1e57de00-c78a-11e9-9251-2fc3035fa318.png)
![image](https://user-images.githubusercontent.com/41439659/63654944-37608f00-c78a-11e9-958e-0b3c19ea1e8c.png)
![image](https://user-images.githubusercontent.com/41439659/63654946-43e4e780-c78a-11e9-822d-0bb91754be1d.png)

My only guess that it could be a problem with orientation. What I mean is, my y-axis is negative above the origin, and positive below it. However, this still wouldn't explain some of the artefacts.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing KorMA polygon collision and shape operations with unit scales near 0.001, comparing them with scale 1.0 and the attached normal and flawed examples. Investigate whether coordinate orientation or small-scale arithmetic explains the artefacts; done means collision results remain accurate at the reported scales.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.