简体   繁体   English

将网格表示为对象

[英]Represent grid as an object

What's reasonable way to represent a grid in terms of an object? 用对象表示网格的合理方法是什么? It's part of a two dimensional graphic programming exercise where at the center of the grid is "me". 这是二维图形编程练习的一部分,其中网格的中心是“我”。

The object needs to be scalable up to 20,20. 该对象需要扩展到20,20。

So if I have a 3,3 grid I need to know that I am in grid 1,1 (center) and that 0,0 is lower right. 因此,如果我有一个3,3网格,我需要知道我在网格1,1(中心)中,而0,0位于右下角。 And if I have an grid of 5,5 I need to know that 2,2 is the center and 0,0 is the center. 如果我有一个5,5的网格,我需要知道2,2是中心,而0,0是中心。

如果您需要降低复杂性并降低网格的其他顺序,则可以使用空间填充曲线,例如z曲线,hilbert曲线,peano曲线。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM