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

half edge neighbor is incorrect #37

Closed
godpenguin7 opened this issue Dec 24, 2018 · 3 comments
Closed

half edge neighbor is incorrect #37

godpenguin7 opened this issue Dec 24, 2018 · 3 comments

Comments

@godpenguin7
Copy link

when i iterate through a site's halfedges and look at their neighbors, they do not correspond to actual neighbors. and even if i look at the half edge's corresponding edge, its two sites are not neighboring in the diagram.
untitled

@godpenguin7
Copy link
Author

godpenguin7 commented Dec 24, 2018

int i = rand() % myCells.size();

myCells[ i ].selected = true;

const jcv_site* site = &jcv_diagram_get_sites( &diagram )[ i ];

const jcv_graphedge* edge = site->edges;

while ( edge != nullptr )
{
	const jcv_site* neighbor;

	if ( edge->edge->sites[ 0 ] == site )
	neighbor = edge->edge->sites[ 1 ];
	else
	neighbor = edge->edge->sites[ 0 ];

	if ( neighbor != nullptr )
	{
		myCells[ neighbor->index ].selected = true;
	}

	edge = edge->next;
}

@JCash
Copy link
Owner

JCash commented Dec 24, 2018 via email

@godpenguin7
Copy link
Author

you were right totally my fault, using site->index fixed it. thanks a lot, i was dreading switching back to this other voronoi library because yours is much faster.

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