Skip to content

Conversation

GlaDos28
Copy link
Contributor

@GlaDos28 GlaDos28 commented Jan 10, 2019

Corrected intersection point formula: the main mistake (or misprint) is positive sign of dot product in dist variable. One can manually check on paper that there are both negative signs of summands.

Tested the same manual function analogue in GDScript, in my project it works, unlike the previous version.

@Chaosus Chaosus modified the milestones: 3.2, 3.1 Jan 11, 2019
@GlaDos28 GlaDos28 changed the title fixed invalid implementation of Plane::intersects_segment fixed invalid implementation of Plane::intersects_segment and Plane::intersects_ray Jan 11, 2019
@akien-mga
Copy link
Member

Could you squash commits together?

@akien-mga akien-mga merged commit 3652442 into godotengine:master Jan 11, 2019
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

I was notified by email that this apparently broke the GridMap editor plugin. Haven't checked yet myself.

@GlaDos28
Copy link
Contributor Author

GlaDos28 commented Jan 13, 2019

Rather strange. Well, if it broke something, code should be returned in the previous state (it was already done, I know). But I derived the formula on a paper, more than that, in my project my version works, but not older version.

Unfortunately I have not enough time to look more detailed all this situation. If one can make unit-tests or something like that to make sure plane intersection methods works as needed (not plugin mistake or something else), it will be great.

@akien-mga here are some links:
http://www.ambrsoft.com/TrigoCalc/Plan3D/PlaneLineIntersection_.htm
http://geomalgorithms.com/a05-_intersect-1.html

Note the same sign of summands in the numerator: -('dot' + d).
But in the initial version they differ. Perhaps it's related to disambiguation of d constant (d can be actually -d or something like that).

@akien-mga
Copy link
Member

I'll revert it for now (#24964). Can be reassessed once 3.1 is released with a proper review of the equations and their use in the engine.

@aaronfranke
Copy link
Member

@GlaDos28 I suggest running a recursive grep (grep -R) and search for every place this function is used so that you can fix that code as well. Still, probably best for 3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants