Orientação gerada a partir de informações públicas. Apenas para referência.
superdeclarative_geometry é um pacote Dart que oferece suporte de primeira classe para ângulos, coordenadas polares e cálculos geométricos. Projetado para precisão e facilidade de uso, fornece APIs intuitivas para trabalhar com matemática rotacional, transformações vetoriais e conversões de sistemas de coordenadas. Ideal para aplicações que exigem manipulação avançada de geometria, como animações, desenvolvimento de jogos ou visualização de dados. O pacote é multiplataforma, suportando Android, iOS, Web, macOS, Windows e Linux, tornando-o versátil para projetos Flutter em diferentes dispositivos.
Casos de uso
Renderização de gráficos 2D/3D
Animações de interface interativa
mecânicas de desenvolvimento de jogos
Visualização de dados com layouts radiais
Conversões de sistema de coordenadas
simulações de física rotacional
Principais recursos
Tipos nativos de ângulo e coordenadas polares
Transformações geométricas eficientes
Compatibilidade multiplataforma
Design de API limpo e legível
Suporte para radianos e graus
Utilitários de conversão embutidos
Indicado para
Desenvolvedores Flutter trabalhando com geometria
Designers de UI/UX que precisam de rotações precisas
Desenvolvedores de jogos que precisam de matemática vetorial
Angles are confined to values in (-360°, 360°). For values beyond this range, the concept of a Rotation is provided.
A Rotation is almost identical to an Angle except that a Rotation can be arbitrarily large in the positive or negative direction. This allows for the accumulation of turns over time.
Create a Rotation:
final rotation = Rotation.fromDegrees(540);
Add, subtract, multiply, and divide Rotations just like Angles.
Reduce a Rotation to an Angle:
Rotation.fromDegrees(540).reduceToAngle();
Polar Coordinates
Define polar coordinates by a radius and an angle, or by a Cartesian point:
// Map to Cartesian coordinates.finalPoint point = PolarCoord(100, Angle.fromDegrees(45)).toCartesian();
Cartesian Orientations
Different use-cases treat angles in different ways.
Mathematics treats the positive x-axis as a 0° angle and treats positive angles as running counter-clockwise.
Flutter app screens treat the positive x-axis as a 0° angle, but then treats positive angles as running clockwise.
Ship navigation treats the positive y-axis as a 0° angle and then treats positive angles as running clockwise.
Each of these situations apply a different orientation when mapping an angle, or a polar coordinate, to a location in Cartesian space. This concept of orientation is supported by superdeclarative_geometry by way of CartesianOrientations.
Both Angle and PolarCoord support CartesianOrientation mappings.
final polarCoord = PolarCoord(100, Angle.fromDegrees(30));
// Treat angles like a Flutter screen.// This point is 30° clockwise from the x-axis.final screenPoint = polarCoord.toCartesian(); // defaults to "screen" orientation// Treat angles like mathematics.// This point is 30° counter-clockwise from the x-axis.final mathPoint = polarCoord.toCartesian(orientation: CartesianOrientation.math);
// Treat angles like navigators.// This point is 30° clockwise from the y-axis.final navigationPoint = polarCoord.toCartesian(orientation: CartesianOrientation.navigation);
You can define a custom CartesianOrientation by implementing the interface. Then, you can pass an instance of your custom orientation into PolarCoord's toCartesian() method.