Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The result of dividing a plane triangle is [] #151

Closed
jynxio opened this issue Nov 8, 2021 · 2 comments
Closed

The result of dividing a plane triangle is [] #151

jynxio opened this issue Nov 8, 2021 · 2 comments

Comments

@jynxio
Copy link

jynxio commented Nov 8, 2021

Direction:

Suppose the format of the three-dimensional coordinates is [X,Y,Z].
Suppose there are triangle A and triangle B, the set of vertex coordinates of triangle A is [0,0,0, 1,2,0, 2,0,0], B is [0,0,0, 1,0,2, 2,0,0].
Obviously their shapes are the same, except that A is located on the XY plane and B is located on the XZ plane, but the result of earcut A is valid, but the result of earcut B is invalid(see the example below for details), this is the problem I encountered.
Excuse me, is this because of my wrong way of use, or is it because of a bug in the program?

Example

const d_a = [0,0,0, 1,2,0, 2,0,0];
const d_b = [0,0,0, 1,0,2, 2,0,0];

earcut(d_a, null, 3); // return [1, 0, 2]
earcut(d_b, null, 3); // return []

@mourner
Copy link
Member

mourner commented Nov 8, 2021

It's Earcut's design limitation — it only triangulates the XY projection in 2D plane and passes Z as is. See #21 for the discussion.

@mourner mourner closed this as completed Nov 8, 2021
@jynxio
Copy link
Author

jynxio commented Nov 9, 2021

It's Earcut's design limitation — it only triangulates the XY projection in 2D plane and passes Z as is. See #21 for the discussion.

Thank you, I get it :)

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

No branches or pull requests

2 participants