in src/WordCloud.ts [1335:1374]
private checkIntersect(word: WordCloudDataPoint, surface: number[]): boolean {
let shiftWidth: number = this.specialViewport.width >> WordCloud.WidthOffset,
sprite: number[] = word.sprite,
widthOfWord: number = word.width >> WordCloud.WidthOffset,
lx: number = word.x - (widthOfWord << WordCloud.LxOffset),
sx: number = lx & WordCloud.SxMask,
msx: number = WordCloud.TheFirstByteMask - sx,
heightOfWord: number = word.y1 - word.y0,
x: number = (word.y + word.y0) * shiftWidth + (lx >> WordCloud.WidthOffset);
for (let i: number = 0; i < heightOfWord; i++) {
let lastSprite: number = 0;
for (let j: number = 0; j <= widthOfWord; j++) {
let mask: number = 0,
leftMask: number,
intersectMask: number = 0;
leftMask = lastSprite << msx;
if (j < widthOfWord) {
lastSprite = sprite[i * widthOfWord + j];
}
mask = j < widthOfWord
? lastSprite >>> sx
: 0;
intersectMask = (leftMask | mask) & surface[x + j];
if (intersectMask) {
return true;
}
}
x += shiftWidth;
}
return false;
}