패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.2.0

superdeclarative_geometry

각도, 극좌표 등에 대한 1등급 지원.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
27
좋아요
32
Pub 점수
150

패키지 설치

flutter pub add superdeclarative_geometry

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

superdeclarative_geometry는 각도, 극좌표 및 기하 계산에 대한 1등급 지원을 제공하는 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.

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.