• 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

0.0
/lib/src/vector_math_64/triangle.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_64.dart';
6

7
/// Defines a triangle by three points.
8
class Triangle {
9
  final Vector3 _point0;
10
  final Vector3 _point1;
11
  final Vector3 _point2;
12

13
  /// The first point of the triangle.
14
  Vector3 get point0 => _point0;
×
15

16
  /// The second point of the triangle.
17
  Vector3 get point1 => _point1;
×
18

19
  /// The third point of the triangle.
20
  Vector3 get point2 => _point2;
×
21

22
  /// Create a new, uninitialized triangle.
23
  Triangle()
×
NEW
24
    : _point0 = Vector3.zero(),
×
NEW
25
      _point1 = Vector3.zero(),
×
NEW
26
      _point2 = Vector3.zero();
×
27

28
  /// Create a triangle as a copy of [other].
29
  Triangle.copy(Triangle other)
×
NEW
30
    : _point0 = Vector3.copy(other._point0),
×
NEW
31
      _point1 = Vector3.copy(other._point1),
×
NEW
32
      _point2 = Vector3.copy(other._point2);
×
33

34
  /// Create a triangle by three points.
35
  Triangle.points(Vector3 point0, Vector3 point1, Vector3 point2)
×
NEW
36
    : _point0 = Vector3.copy(point0),
×
NEW
37
      _point1 = Vector3.copy(point1),
×
NEW
38
      _point2 = Vector3.copy(point2);
×
39

40
  /// Copy the triangle from [other] into this.
41
  void copyFrom(Triangle other) {
×
42
    _point0.setFrom(other._point0);
×
43
    _point1.setFrom(other._point1);
×
44
    _point2.setFrom(other._point2);
×
45
  }
46

47
  /// Copy the normal of this into [normal].
48
  void copyNormalInto(Vector3 normal) {
×
49
    final v0 = point0.clone()..sub(point1);
×
50
    normal
51
      ..setFrom(point2)
×
52
      ..sub(point1)
×
53
      ..crossInto(v0, normal)
×
54
      ..normalize();
×
55
  }
56

57
  /// Transform this by the transform [t].
58
  void transform(Matrix4 t) {
×
59
    t
60
      ..transform3(_point0)
×
61
      ..transform3(_point1)
×
62
      ..transform3(_point2);
×
63
  }
64

65
  /// Translate this by [offset].
66
  void translate(Vector3 offset) {
×
67
    _point0.add(offset);
×
68
    _point1.add(offset);
×
69
    _point2.add(offset);
×
70
  }
71
}
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