Comments (5)
It sounds definitely useful, but should these bounds also take into account object alignment and rotation then?
And I think bounding_rect
might be a more fitting name, although the QGraphicsItem::boundingRect
function does not include the item's position and rotation.
from rs-tiled.
OK, we could add a local_bounding_rect
function that doesn't apply transformations for now, and then we could figure out rotations/position/etc on a global_bounding_rect
function. Does that sound good?
from rs-tiled.
I'm not sure about the verbosity of these names. Wouldn't a bounding_rect
that just returns the local rectangle be fine, and we could call the global one aabb
? But if you prefer the explicit local/global I'm fine with that too.
Btw, you initially proposed only a global_bounds
, so I asked whether that should then also take into account alignment and rotation because I thought those things should probably go together. I didn't mean to propose we also add a version returning a local rectangle. Maybe we should wait with adding that until there's an actual need.
from rs-tiled.
Btw, you initially proposed only a
global_bounds
, so I asked whether that should then also take into account alignment and rotation because I thought those things should probably go together. I didn't mean to propose we also add a version returning a local rectangle. Maybe we should wait with adding that until there's an actual need.
I didn't think of the implications of having global
in the name. While it is true that global bounds should include rotation and alignment, it would complicate the implementation. There are times where rotation isn't applied to an object and it is useful to know its bounds, for instance when you want to obtain the width/height of a rect object quickly without having to match like in the example above, so I think having local
in the name is best to differentiate between a possible global
implementation later down the line.
from rs-tiled.
so I think having
local
in the name is best to differentiate between a possibleglobal
implementation later down the line.
Alright. What about alignment, though? I guess it is relevant even for a local bounding rectangle. For a rectangle with top-left alignment, the local bounding rect would have its top-left at (0,0)
, but for bottom-left alignment, that rectangle would need to have its top-left at (0,-height)
, right?
Of course the problem with alignment is that it depends not only on the type of object, but also on the tileset object alignment property as well as on the map orientation.
from rs-tiled.
Related Issues (20)
- tiled::FiniteTileLayer::get_tile returns empty tiles HOT 7
- Optional GIDs feature HOT 1
- Default zstd feature is unhelpful for wasm builds HOT 2
- Add support for tileset offset
- Nicer way to iterate over layers of a given type HOT 2
- Expose map's staggeraxis and staggerindex options.
- Allow obtaining the path of tilemaps that have been loaded HOT 9
- Loading map with TSX tileset error "Missing attribute: tilecount" HOT 11
- More convenient way to load embedded maps HOT 8
- Image docs are outdated
- get rotaion of tile HOT 3
- Support for Tiled Custom Types HOT 2
- Unsigned indecies for getting a tile HOT 1
- Not getting all of the tiles when iterating? HOT 6
- Parsing may be slow for some use cases HOT 7
- Add way to get the LayerData from a more specific layer type like GroupLayer HOT 2
- text for text objects is not parsed HOT 5
- `object.id()` returns a GID HOT 2
- Async loading HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rs-tiled.