Skip to content

Can you help me understand why there is a discrepancy in SPAN_HEIGHT_BITS and SPAN_MAX_HEIGHT values between recastnavigation and recast4j? #173

Answered by ppiastucki
ikpil asked this question in Q&A
Discussion options

You must be logged in to vote

rcSpan struct is defined as follows in recastnavigation:

struct rcSpan
{
	unsigned int smin : RC_SPAN_HEIGHT_BITS;
	unsigned int smax : RC_SPAN_HEIGHT_BITS;
	unsigned int area : 6;
	rcSpan* next;
};

Which means smin occupies 13 bits, smax another 13 bits and area the remaining 6 bits of the 32-bit word.

These values are expended to full 32-bit integers in recast4j as follows:

public class Span {
    public int smin;
    public int smax;
    public int area;
    public Span next;
}

Hence the limits are increased, potentially they could be increased to 31 bits instead of 20 if really needed.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ppiastucki
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #172 on January 04, 2024 10:24.