Я хочу найти точку в прямоугольнике между заданными точками, используя python, если это возможно в django
Вот в моих данных пунктах Я пытался подобрать запрос из django, пожалуйста, помогите мне найти лучший способ.
y=800.2816162109375 1200, 750
block_list = Block.objects.filter(
Q(block_coordinates__topRight__y__gte=y)&Q(block_coordinates__botRight__y__gte=y)&
Q(block_coordinates__topLeft__x__gte=x)&Q(block_coordinates__topRight__x__lte=x)&
Q(block_coordinates__topLeft__y__lte=y) | Q(block_coordinates__botLeft__y__gte=y)
).values('block_id','block_coordinates') ```
'block_id': '1.0_B3',
'block_coordinates': {
'x': 1507.2816162109375,
'y': 776.7411499023438,
'pivot': {
'x': 1814.5316162109375,
'y': 806.2411499023438
},
'botLeft': {
'x': 1505.9722457931548,
'y': 814.236612827126
},
'topLeft': {
'x': 1510.0878777440582,
'y': 755.3803338617964
},
'botRight': {
'x': 2118.9753546778165,
'y': 857.1019659428911
},
'topRight': {
'x': 2123.09098662872,
'y': 798.2456869775615
},
'thetaDegrees': 4,
'thetaRadians': 0.06981317007977318
}
}```
this is the object stored in db column, i want filter point is in with this coordinates or not.
like
x = 1600, y=800
assume that x,y are point i want to find x,y is present or not.
this is my approach but it was not working as accepted can some help me how to find.
```block_list = Block.objects.filter(
Q(block_coordinates__topRight__y__gte=y)&Q(block_coordinates__botRight__y__gte=y)&
Q(block_coordinates__topLeft__x__gte=x)&Q(block_coordinates__topRight__x__lte=x)&
Q(block_coordinates__topLeft__y__lte=y) | Q(block_coordinates__botLeft__y__gte=y)
).values('block_id','block_coordinates')```