mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-08-29 13:20:32 +00:00
correct BinaryColumn logic for boolean ops on columns with differeny min Y
This commit is contained in:
@@ -54,6 +54,11 @@ public class BinaryColumn {
|
|||||||
return data[y - minY];
|
return data[y - minY];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean contains(int y) {
|
||||||
|
return y >= minY && y < maxY;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform an action for all heights which have been set.
|
* Perform an action for all heights which have been set.
|
||||||
* @param consumer Action to perform
|
* @param consumer Action to perform
|
||||||
@@ -99,17 +104,18 @@ public class BinaryColumn {
|
|||||||
BinaryColumn next = new BinaryColumn(smallMinY, bigMaxY);
|
BinaryColumn next = new BinaryColumn(smallMinY, bigMaxY);
|
||||||
|
|
||||||
for(int i = smallMinY; i < bigMaxY; i++) {
|
for(int i = smallMinY; i < bigMaxY; i++) {
|
||||||
int index = i - smallMinY;
|
|
||||||
boolean left = false;
|
boolean left = false;
|
||||||
boolean right = false;
|
boolean right = false;
|
||||||
if(this.data.length > index) {
|
|
||||||
left = this.data[index];
|
if(this.contains(i)) {
|
||||||
|
left = this.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(that.data.length > index) {
|
if(that.contains(i)) {
|
||||||
right = that.data[index];
|
right = that.get(i);
|
||||||
}
|
}
|
||||||
next.data[index] = operator.apply(left, right);
|
|
||||||
|
next.data[i - smallMinY] = operator.apply(left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
return next;
|
return next;
|
||||||
|
|||||||
Reference in New Issue
Block a user