• 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

59.32
/lib/src/vector_math/quad.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 quad by four points.
8
class Quad {
9
  final Vector3 _point0;
10
  final Vector3 _point1;
11
  final Vector3 _point2;
12
  final Vector3 _point3;
13

14
  /// The first point of the quad.
15
  Vector3 get point0 => _point0;
4✔
16

17
  /// The second point of the quad.
18
  Vector3 get point1 => _point1;
4✔
19

20
  /// The third point of the quad.
21
  Vector3 get point2 => _point2;
4✔
22

23
  /// The fourth point of the quad.
24
  Vector3 get point3 => _point3;
4✔
25

26
  /// Create a new, uninitialized quad.
27
  Quad()
×
NEW
28
    : _point0 = Vector3.zero(),
×
NEW
29
      _point1 = Vector3.zero(),
×
NEW
30
      _point2 = Vector3.zero(),
×
NEW
31
      _point3 = Vector3.zero();
×
32

33
  /// Create a quad as a copy of [other].
34
  Quad.copy(Quad other)
1✔
35
    : _point0 = Vector3.copy(other._point0),
2✔
36
      _point1 = Vector3.copy(other._point1),
2✔
37
      _point2 = Vector3.copy(other._point2),
2✔
38
      _point3 = Vector3.copy(other._point3);
2✔
39

40
  /// Create a quad by four points.
41
  Quad.points(Vector3 point0, Vector3 point1, Vector3 point2, Vector3 point3)
2✔
42
    : _point0 = Vector3.copy(point0),
2✔
43
      _point1 = Vector3.copy(point1),
2✔
44
      _point2 = Vector3.copy(point2),
2✔
45
      _point3 = Vector3.copy(point3);
2✔
46

47
  /// Copy the quad from [other] into this.
48
  void copyFrom(Quad other) {
×
49
    _point0.setFrom(other._point0);
×
50
    _point1.setFrom(other._point1);
×
51
    _point2.setFrom(other._point2);
×
52
    _point3.setFrom(other._point3);
×
53
  }
54

55
  /// Copy the normal of this into [normal].
56
  void copyNormalInto(Vector3 normal) {
1✔
57
    final v0 = _point0.clone()..sub(_point1);
4✔
58
    normal
59
      ..setFrom(_point2)
2✔
60
      ..sub(_point1)
2✔
61
      ..crossInto(v0, normal)
1✔
62
      ..normalize();
1✔
63
  }
64

65
  /// Copies the two triangles that define this.
66
  void copyTriangles(Triangle triangle0, Triangle triangle1) {
1✔
67
    triangle0._point0.setFrom(_point0);
3✔
68
    triangle0._point1.setFrom(_point1);
3✔
69
    triangle0._point2.setFrom(_point2);
3✔
70
    triangle1._point0.setFrom(_point0);
3✔
71
    triangle1._point1.setFrom(_point3);
3✔
72
    triangle1._point2.setFrom(_point2);
3✔
73
  }
74

75
  /// Transform this by the transform [t].
76
  void transform(Matrix4 t) {
×
77
    t
78
      ..transform3(_point0)
×
79
      ..transform3(_point1)
×
80
      ..transform3(_point2)
×
81
      ..transform3(_point3);
×
82
  }
83

84
  /// Translate this by [offset].
85
  void translate(Vector3 offset) {
×
86
    _point0.add(offset);
×
87
    _point1.add(offset);
×
88
    _point2.add(offset);
×
89
    _point3.add(offset);
×
90
  }
91

92
  /// Returns a printable string
93
  @override
×
NEW
94
  String toString() =>
×
NEW
95
      '[0] $_point0\n[1] $_point1\n'
×
UNCOV
96
      '[2] $_point2\n[3] $_point3\n';
×
97

98
  /// Check if two quad are the same.
99
  @override
1✔
100
  bool operator ==(Object other) =>
101
      (other is Quad) &&
1✔
102
      (_point3 == other._point3) &&
3✔
103
      (_point2 == other._point2) &&
3✔
104
      (_point1 == other._point1) &&
3✔
105
      (_point0 == other._point0);
3✔
106

107
  @override
1✔
108
  int get hashCode => Object.hash(_point0, _point1, _point2, _point3);
5✔
109
}
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