From 8f80ddb88d2db0e2c88dc618903d113278d17689 Mon Sep 17 00:00:00 2001 From: mahaamimran Date: Thu, 22 Oct 2026 13:15:57 +0500 Subject: [PATCH] [vector_math] Document SphereGenerator API --- packages/vector_math/CHANGELOG.md | 4 ++++ .../generators/sphere_generator.dart | 14 ++++++++++---- packages/vector_math/pubspec.yaml | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/vector_math/CHANGELOG.md b/packages/vector_math/CHANGELOG.md index bff8ac07..5be67968 100644 --- a/packages/vector_math/CHANGELOG.md +++ b/packages/vector_math/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.4.5 + +* Documents the public `SphereGenerator` API. + ## 2.4.4 * Replaces dynamic multiplication in `TransformFilter.filterInplace` with `Matrix4.transform3` to fix an analyzer error on newer Dart SDKs. diff --git a/packages/vector_math/lib/src/vector_math_geometry/generators/sphere_generator.dart b/packages/vector_math/lib/src/vector_math_geometry/generators/sphere_generator.dart index b4be3281..b3858ffc 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/generators/sphere_generator.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/generators/sphere_generator.dart @@ -2,12 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// TODO(stuartmorgan): Remove this and fix violations. See -// https://github.com/flutter/flutter/issues/186827 -// ignore_for_file: public_member_api_docs - part of '../../../vector_math_geometry.dart'; +/// Generates a UV sphere mesh centered at the origin, with its poles on the +/// Y axis. class SphereGenerator extends GeometryGenerator { late double _radius; late int _latSegments; @@ -19,6 +17,14 @@ class SphereGenerator extends GeometryGenerator { @override int get indexCount => 6 * _lonSegments * _latSegments; + /// Creates a sphere mesh of the given [radius]. + /// + /// The [latSegments] parameter controls how many bands the sphere is divided + /// into from pole to pole, and [lonSegments] controls how many segments are + /// used around the Y axis. + /// + /// The [flags] parameter configures which vertex attributes to generate, and + /// [filters] specifies any mesh transformations to apply after generation. MeshGeometry createSphere( num radius, { int latSegments = 16, diff --git a/packages/vector_math/pubspec.yaml b/packages/vector_math/pubspec.yaml index 21624bc1..62bc62e9 100644 --- a/packages/vector_math/pubspec.yaml +++ b/packages/vector_math/pubspec.yaml @@ -5,7 +5,7 @@ name: vector_math description: A vector math library for 2D and 3D applications, supporting 2D, 3D, and 4D matrices. repository: https://github.com/flutter/core-packages/tree/main/packages/vector_math issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+vector_math%22 -version: 2.4.4 +version: 2.4.5 environment: sdk: ^3.10.0