Pick a prop. camera has been positioned such that a ray pick at screen-coordinates p hits points with x-y coordinates xy. data contains: expected pick result, block#, cell id, point id
(p,xy,data)
| 169 | return errors |
| 170 | |
| 171 | def cellPick(p,xy,data): |
| 172 | """ |
| 173 | Pick a prop. camera has been positioned such that a ray pick at |
| 174 | screen-coordinates p hits points with x-y coordinates xy. |
| 175 | data contains: expected pick result, block#, cell id, point id |
| 176 | """ |
| 177 | errors=0 |
| 178 | result=cellPicker.Pick(p[0],p[1],0,r)==1 |
| 179 | if result != data[0]: |
| 180 | print('cell pick at {} result: expected {} actual {}' |
| 181 | .format(xy,data[0],result)) |
| 182 | errors+=1 |
| 183 | if cellPicker.GetFlatBlockIndex() != data[1]: |
| 184 | print('cell pick at {} flat block index expected {} actual {}' |
| 185 | .format(xy,data[1],cellPicker.GetFlatBlockIndex())) |
| 186 | errors+=1 |
| 187 | if cellPicker.GetCellId() != data[2]: |
| 188 | print('cell pick at {} cell id expected {} actual {}' |
| 189 | .format(xy,data[2],cellPicker.GetCellId())) |
| 190 | errors+=1 |
| 191 | if cellPicker.GetPointId() != data[3]: |
| 192 | print('cell pick at {} point id expected {} actual {}' |
| 193 | .format(xy,data[3],cellPicker.GetPointId())) |
| 194 | errors+=1 |
| 195 | |
| 196 | if debug and errors: |
| 197 | if result>0: |
| 198 | if cellPicker.GetFlatBlockIndex(): |
| 199 | print('cell pick at {} picked cell {} point {} of block {}' |
| 200 | .format(xy,cellPicker.GetCellId(),cellPicker.GetPointId(),cellPicker.GetFlatBlockIndex())) |
| 201 | else: |
| 202 | print('cell pick at {} picked cell {} point {}' |
| 203 | .format(xy,cellPicker.GetCellId(),cellPicker.GetPointId())) |
| 204 | else: |
| 205 | print('cell pick at {} result:{}'.format(xy,result)) |
| 206 | return errors |
| 207 | |
| 208 | |
| 209 | def pick(xy,propPickData,pointPickData,cellPickData): |