パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.2.0

superdeclarative_geometry

角度、極座標などに対する最高レベルのサポート。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
27
いいね数
32
Pub ポイント
150

パッケージをインストール

flutter pub add superdeclarative_geometry

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

superdeclarative_geometry は、角度、極座標、および幾何計算に対する第一級のサポートを提供する Dart パッケージです。正確さと使いやすさを重視して設計されており、回転数学、ベクトル変換、座標系変換に役立つ直感的な API を提供します。アニメーション、ゲーム開発、データ可視化など、高度な幾何処理を必要とするアプリケーションに最適です。このパッケージはクロスプラットフォームで、Android、iOS、Web、macOS、Windows、Linux をサポートしており、さまざまなデバイスでの Flutter プロジェクトに柔軟に対応できます。

用途

  • 2D/3D グラフィックスレンダリング
  • インタラクティブUIアニメーション
  • ゲーム開発メカニクス
  • ラジアルレイアウトを用いたデータ可視化
  • 座標系の変換
  • 回転物理学のシミュレーション

主な機能

  • ネイティブな角度および極座標タイプ
  • 効率的な幾何変換
  • クロスプラットフォーム互換性
  • 洗練された、読みやすいAPI設計
  • ラジアンおよび度数のサポート
  • 組み込みの変換ユーティリティ

適している対象

  • ジオメトリを使用するFlutter開発者
  • 正確な回転が必要なUI/UXデザイナー
  • ベクトル数学を必要とするゲーム開発者
  • ビジュアライゼーションツールの作成者
  • 数学的概念を含む教育用アプリ

注意事項

  • 極座標および角度数学の理解が必要
  • 単純な線形レイアウトにオーバーヘッドを追加する可能性があります
  • 幾何学的複雑性を持つプロジェクトに最適
  • 高頻度のリアルタイム計算には最適化されていない
  • 基本的な例以外のドキュメントは限られている

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

SuperDeclarative Geometry

First-class support for angles, polar coordinates, and related math.


If you get value from this package, please consider supporting SuperDeclarative!


Get Started

pub

dependencies:
  superdeclarative_geometry: ^[VERSION]

Quick Reference

Angles

Create an Angle from degrees or radians:

final degreesToRadians = Angle.fromDegrees(45);
final radiansToDegrees = Angle.fromRadians(pi / 4);

Retrieve Angle values as degrees or radians:

myAngle.degrees;
myAngle.radians;

Determine an Angle's direction and force it to be positive or negative:

myAngle.isPositive;
myAngle.isNegative;

myAngle.makePositive(); // Ex: -270° ->  90°
myAngle.makeNegative(); // Ex:  270° -> -90°

Determine the category of an Angle:

myAngle.isAcute;
myAngle.isObtuse;
myAngle.isReflexive;
myAngle.category;

Determine if two Angles are equivalent, regardless of direction:

Angle.fromDegrees(90).isEquivalentTo(Angle.fromDegrees(-270));

Invert, add, subtract, multiply, and divide Angles:

-Angle.fromDegrees(30);

Angle.fromDegrees(30) + Angle.fromDegrees(15);

Angle.fromDegrees(30) - Angle.fromDegrees(15);

Angles.fromDegrees(45) * 2;

Angles.fromDegrees(90) / 2;

Rotate an Angle:

final Rotation rotation = myAngle.rotate(Angle.fromDegrees(150));

Rotations

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:

PolarCoord(100, PolarCoord.fromDegrees(45));

CartesianPolarCoords.fromPoint(Point(0, 100));

Add, subtract, multiply, and divide PolarCoords:

PolarCoord(100, Angle.fromDegrees(45)) + PolarCoord(200, Angle.fromDegrees(135));

PolarCoord(100, Angle.fromDegrees(45)) - PolarCoord(200, Angle.fromDegrees(135));

PolarCoord(100, Angle.fromDegrees(15)) * 2;

PolarCoord(200, Angle.fromDegrees(30)) / 2;

Map a PolarCoord to a Cartesian Point:

// Map to Cartesian coordinates.
final Point 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.

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。