| 116 | } |
| 117 | |
| 118 | S32 xPartitionInsert(_tagPartition* part, void* insert_data, xVec3* insert_pos) |
| 119 | { |
| 120 | if (insert_pos->x < part->min.x || insert_pos->x > part->max.x || insert_pos->y < part->min.y || |
| 121 | insert_pos->y > part->max.y || insert_pos->z < part->min.z || insert_pos->z > part->max.z) |
| 122 | { |
| 123 | PartitionSpaceInsert(&part->global, insert_data); |
| 124 | return -1; |
| 125 | } |
| 126 | |
| 127 | S32 idx = xPartitionGetTrueIdx(part, (insert_pos->x - part->min.x) / part->space_dim.x, |
| 128 | (insert_pos->y - part->min.y) / part->space_dim.y, |
| 129 | (insert_pos->z - part->min.z) / part->space_dim.z); |
| 130 | PartitionSpaceInsert(&part->space[idx], insert_data); |
| 131 | |
| 132 | return idx; |
| 133 | } |
| 134 | |
| 135 | S32 xPartitionUpdate(_tagPartition* part, void* data, S32 old_idx, xVec3* current_pos) |
| 136 | { |
no test coverage detected