Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения

Boost Polygon Library: Isotropy

Boost , ,


Isotropy

What is isotropy?

Isotropy - Function: adjective Etymology: International Scientific Vocabulary
: exhibiting properties (as velocity of light transmission) with the same values when measured along axes in all directions <an isotropic crystal>

In computational geometry things are often symmetric and invariant to direction and orientation.  This invariance to direction is called isotropy.  In such situations it is convenient to parameterize direction or orientation and write code that is invariant to the direction or orientation in which it is applied.  To do this effectively we provide an internally consistent set of isotropic data types to represent program data that describes orientations and directions.  These data types are:

  • direction_1d - имеет одно из следующих 2 состояний: LOW, HIGH
  • Ориентация_2d - имеет одно из следующих 2 состояний: Горизонтальный, Вертикальный
  • direction_2d - имеет одно из следующих 4 состояний: Запад, Восток, Юг, Север
  • Ориентация_3d - имеет одно из следующих 3 состояний: Горизонтальный, Вертикальный, Проксимальный
  • direction_3d - имеет одно из следующих 6 состояний: Запад, Восток, Юг, Север, Вниз, Вверх

The isotropic types create a system and interact with each other in various ways, such as casting.  Together they create a language for describing isotropic situations programmatically.  For instance, to get the positive direction_2d from an orientation_2d you would call a member function of orientation_2d and pass a direction_1d:

orientation_2d orient = HORIZONTAL;
direction_2d dir = orient.get_direction(direction_1d(HIGH));
assert(dir == EAST);

The motivation for providing isotropic data types is to encourage programming at a higher level of abstraction where program behavior is controlled by program data passed into function calls rather than flow control syntax.  Isotropic programming style is particularly applicable to working with points, intervals and rectangles.  Often times the implementation of such logic is identical when implemented for the x or y coordinates, except that the names of functions and data members are changed in a mechanical way leading to code duplication and bloat that results in copy-paste programming errors and maintenance problems where changes made to a given code block relating to x coordiantes are not duplicated to the code block that refers to y.  Isotropy therefore represents an opportunity to refactor and improve the quality of low level geometry code especially in regard to inter-relating coordinates, points, intervals and rectangles.

direction_1d

The direction_1d data type has two possible states.  These are the positive and negative directions on a continuum such as the number line.   These states can be described by one of several direction_1d_enum values:  We make clockwise and counterclockwise winding orientation of polygons a direction 1d value instead of providing a separate winding_orientation data type.  This is because winding orientation can be thought of as positive and negative directions in a 1d (although cyclic) space.  We assign counterclockwise to be the positive direction of travel in the 1d cyclic space to conform with the mathematical convention frequently described as the "right hand rule" which assigns positive normal value to counterclockwise and negative normal value to clockwise as well as the common convention that counterclockwise polygon winding corresponds to positive polygonal regions where as clockwise polygon winding corresponds to hole (negative) polygonal regions.

enum direction_1d_enum {LOW = 0, HIGH = 1,
                        LEFT = 0, RIGHT = 1,
                        CLOCKWISE = 0, COUNTERCLOCKWISE = 1,
                        REVERSE = 0, FORWARD = 1,
                        NEGATIVE = 0, POSITIVE = 1 };

Member Functions

direction_1d(direction_1d_enum val = LOW) Конструктор по умолчанию LOW.
direction_1d(const direction_1d& that) Копировать конструкцию.
direction_1d(const direction_2d& that) Down cast direction_2d, извлечение положительного или отрицательного
direction_1d(const direction_3d& that) Down cast direction_3d, извлечение положительного или отрицательного
direction_1d& operator=(const direction_1d dir) Назначение
direction_1d& operator==(const direction_1d dir) const Эквивалентность
direction_1d& operator!=(const direction_1d dir) const Неравномерность
unsigned int to_int() const Преобразовать в целое число значение текущего состояния для использования в качестве индекса. Auto-cast to int запрещен по соображениям безопасности типа.
direction_1d& backward() Перевернуть направление.
int get_sign() const Возвращается положительное 1 при положительном направлении и отрицательное при отрицательном направлении.

orientation_2d

The orientation_2d data type has two possible states.  These are the horizontal and vertical axis of a 2d Cartesian coordinate system.   These states can be described by one of the two orientation_2d_enum values:

enum orientation_2d_enum { HORIZONTAL = 0, VERTICAL = 1 };

Member Functions

orientation_2d(orientation_2d_enum val = HORIZONTAL) Конструктор по умолчанию HORIZONTAL.
orientation_2d(const orientation_2d& that) Копировать конструкцию.
explicit orientation_2d(const direction_2d& that) Отбрасывайте направление_2d, извлекая горизонтальный или вертикальный тип направления
orientation_2d& operator=(const orientation_2d o) Назначение
orientation_2d& operator==(const orientation_2d o) const Эквивалентность
orientation_2d& operator!=(const orientation_2d o) const Неравномерность
unsigned int to_int() const Преобразовать в целое число значение текущего состояния для использования в качестве индекса.   Autocast to int запрещен по соображениям безопасности типа
orientation_2d& turn_90() Изменение ортогональной ориентации
int get_perpendicular() const Возвращение ортогональной ориентации
int get_direction(direction_1d dir) const Возвращает положительное или отрицательное направление_2d в зависимости от значения dir

direction_2d

The direction_2d data type has four possible states.  These are the cardinal directions of the 2D Cartesian coordinate system.   These states can be described by one of several direction_2d_enum values:

enum direction_2d_enum { WEST = 0, EAST = 1, SOUTH = 2, NORTH = 3 };

Member Functions

direction_2d(direction_2d_enum val = WEST) Конструктор по умолчанию на Западе.
direction_2d(const direction_2d& that) Копировать конструкцию.
direction_1d& operator=(const direction_2d dir) Назначение
direction_1d& operator==(const direction_2d dir) const Эквивалентность
direction_1d& operator!=(const direction_2d dir) const Неравномерность
unsigned int to_int() const Преобразовать в целое число значение текущего состояния для использования в качестве индекса. Auto-cast to int запрещен по соображениям безопасности типа.
direction_2d& backward() Перевернуть направление.
direction_2d& turn(direction_1d dir) Изменение направления_2d влево, если dir низкий, вправо, если dir высокий
direction_2d& left() Изменение направления_2d влево
direction_2d& right() Изменение направления_2d вправо
int is_positive() const Возвращается истинным, если Восточный или Северный
int is_negative() const Вернуть правду, если Запад или Юг
int get_sign() const Возвращается положительное 1 при положительном направлении и отрицательное при отрицательном направлении.

orientation_3d

The orientation_3d data type has three possible states.  These are the horizontal, vertical and proximal (x, y, z) axis of a 3d Cartesian coordinate system.   These states can be described by one of the orientation_2d_enum values or by the orientation_3d_enum value:

enum orientation_3d_enum { PROXIMAL = 2 };

Member Functions

orientation_3d(orientation_2d_enum val = HORIZONTAL) Конструктор по умолчанию HORIZONTAL.
orientation_3d(const orientation_3d& that) Копировать конструкцию.
explicit orientation_3d(const direction_2d& that) Извлечь ориентацию направления
explicit orientation_3d(const direction_3d& that) Извлечь ориентацию направления
orientation_3d(const orientation_2d& that) Вверх отлитая ориентация_2d к ориентации_3d.
orientation_3d(const orientation_3d_enum& that) Конструкция из постоянной стоимости
orientation_3d& operator=(const orientation_3d o) Назначение
orientation_3d& operator==(const orientation_3d o) const Эквивалентность
orientation_3d& operator!=(const orientation_3d o) const Неравномерность
unsigned int to_int() const Преобразовать в целое число значение текущего состояния для использования в качестве индекса.   Autocast to int запрещен по соображениям безопасности типа
int get_direction(direction_1d dir) const Возвращает положительное или отрицательное направление_2d в зависимости от значения dir

direction_3d

The direction_3d data type has six possible states.  These are the cardinal directions of the 3D Cartesian coordinate system.   These states can be described by one of the direction_2d_enum values or the direction_3d_enum values:

enum direction_3d_enum { DOWN = 4, UP = 5 };

Member Functions

direction_3d(direction_2d_enum val = WEST) Конструктор по умолчанию LOW.
direction_3d(direction_3d_enum that) Конструкция из постоянной стоимости
direction_3d(const direction_3d& that) Конструкция копирования
direction_3d(direction_2d that) Скачать игру direction_2d to direction_3d
direction_3d& operator=(const direction_3d dir) Назначение
direction_3d& operator==(const direction_3d dir) const Эквивалентность
direction_2d& operator!=(const direction_3d dir) const Неравномерность
unsigned int to_int() const Преобразовать в целое число значение текущего состояния для использования в качестве индекса. Auto-cast to int запрещен по соображениям безопасности типа.
direction_1d& backward() Перевернуть направление.
int is_positive() const Возвращается истинно, если направление восточное, северное или верхнее.
int is_negative() const Возвращение истинно, если направление западное, южное или нисходящее
int get_sign() const Возвращается положительное 1 при положительном направлении и отрицательное при отрицательном направлении.
 
Copyright: Авторское право © Intel Corporation 2008-2010.
License: Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Статья Boost Polygon Library: Isotropy раздела может быть полезна для разработчиков на c++ и boost.




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: ::


реклама


©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru

Время компиляции файла: 2024-08-30 11:47:00
2025-05-19 21:09:01/0.0098021030426025/1