• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

google / vector_math.dart / 17181727464

04 Aug 2025 07:19PM UTC coverage: 26.702% (+0.3%) from 26.388%
17181727464

push

github

web-flow
Bump min SDK to 3.7, update dependencies, reformat (#348)

496 of 1182 new or added lines in 55 files covered. (41.96%)

18 existing lines in 8 files now uncovered.

4463 of 16714 relevant lines covered (26.7%)

1.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

58.82
/lib/src/vector_math/sphere.dart
1
// Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
2
// All rights reserved. Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
4

5
part of '../../vector_math.dart';
6

7
/// Defines a sphere with a [center] and a [radius].
8
class Sphere {
9
  final Vector3 _center;
10

11
  /// The [radius] of the sphere.
12
  double radius;
13

14
  /// The [center] of the sphere.
15
  Vector3 get center => _center;
4✔
16

17
  /// Create a new, uninitialized sphere.
NEW
18
  Sphere() : _center = Vector3.zero(), radius = 0.0;
×
19

20
  /// Create a sphere as a copy of [other].
21
  Sphere.copy(Sphere other)
×
NEW
22
    : _center = Vector3.copy(other._center),
×
NEW
23
      radius = other.radius;
×
24

25
  /// Create a sphere from a [center] and a [radius].
26
  Sphere.centerRadius(Vector3 center, this.radius)
4✔
27
    : _center = Vector3.copy(center);
4✔
28

29
  /// Copy the sphere from [other] into this.
30
  void copyFrom(Sphere other) {
×
31
    _center.setFrom(other._center);
×
32
    radius = other.radius;
×
33
  }
34

35
  /// Return if this contains [other].
36
  bool containsVector3(Vector3 other) =>
1✔
37
      other.distanceToSquared(center) < radius * radius;
6✔
38

39
  /// Return if this intersects with [other].
40
  bool intersectsWithVector3(Vector3 other) =>
1✔
41
      other.distanceToSquared(center) <= radius * radius;
6✔
42

43
  /// Return if this intersects with [other].
44
  bool intersectsWithSphere(Sphere other) {
1✔
45
    final radiusSum = radius + other.radius;
3✔
46

47
    return other.center.distanceToSquared(center) <= (radiusSum * radiusSum);
5✔
48
  }
49
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc