Merge branch 'fix/edge-point-in-cell' into 'main'
fix: include edge point in isInsideTriangle See merge request oceanbox/Oceanbox.FvcomKit!32
This commit was merged in pull request #33.
This commit is contained in:
18
src/Grid.fs
18
src/Grid.fs
@@ -448,22 +448,8 @@ module Util =
|
||||
let d2 = sign p y z
|
||||
let d3 = sign p z x
|
||||
|
||||
let neg = (d1 <= 0.) || (d2 <= 0.) || (d3 <= 0.)
|
||||
let pos = (d1 >= 0.) || (d2 >= 0.) || (d3 >= 0.)
|
||||
|
||||
(neg && pos) |> not
|
||||
|
||||
let inline isInsideTriangle_dbl (x, y, z) p =
|
||||
let sign (p1x, p1y) (p2x, p2y) (p3x, p3y) =
|
||||
(p1x - p3x) * (p2y - p3y)
|
||||
- (p2x - p3x) * (p1y - p3y)
|
||||
|
||||
let d1 = sign p x y
|
||||
let d2 = sign p y z
|
||||
let d3 = sign p z x
|
||||
|
||||
let neg = (d1 <= 0.0) || (d2 <= 0.0) || (d3 <= 0.0)
|
||||
let pos = (d1 >= 0.0) || (d2 >= 0.0) || (d3 >= 0.0)
|
||||
let neg = (d1 < 0.) || (d2 < 0.) || (d3 < 0.)
|
||||
let pos = (d1 > 0.) || (d2 > 0.) || (d3 > 0.)
|
||||
|
||||
(neg && pos) |> not
|
||||
|
||||
|
||||
Reference in New Issue
Block a user