• 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

82.35
/lib/src/vector_math_geometry/filters/barycentric_filter.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_geometry.dart';
6

7
class BarycentricFilter extends GeometryFilter {
8
  @override
×
NEW
9
  List<VertexAttrib> get generates => <VertexAttrib>[
×
NEW
10
    VertexAttrib('BARYCENTRIC', 3, 'float'),
×
11
  ];
12

13
  @override
1✔
14
  MeshGeometry filter(MeshGeometry mesh) {
15
    final newAttribs = List<VertexAttrib>.from(mesh.attribs);
2✔
16

17
    if (mesh.getAttrib('BARYCENTRIC') == null) {
1✔
18
      newAttribs.add(VertexAttrib('BARYCENTRIC', 3, 'float'));
2✔
19
    }
20

21
    final output = MeshGeometry(mesh.triangleVertexCount, newAttribs);
2✔
22

23
    Vector3List barycentricCoords;
24
    final view = output.getViewForAttrib('BARYCENTRIC');
1✔
25
    if (view is Vector3List) {
1✔
26
      barycentricCoords = view;
27
    } else {
28
      throw UnimplementedError();
×
29
    }
30

31
    final srcAttribs = <VectorList<Vector>>[];
1✔
32
    final destAttribs = <VectorList<Vector>>[];
1✔
33
    for (var attrib in mesh.attribs) {
2✔
34
      if (attrib.name == 'BARYCENTRIC') {
2✔
35
        continue;
36
      }
37

38
      srcAttribs.add(mesh.getViewForAttrib(attrib.name)!);
3✔
39
      destAttribs.add(output.getViewForAttrib(attrib.name)!);
3✔
40
    }
41

42
    final b0 = Vector3(1.0, 0.0, 0.0);
1✔
43
    final b1 = Vector3(0.0, 1.0, 0.0);
1✔
44
    final b2 = Vector3(0.0, 0.0, 1.0);
1✔
45

46
    int i0, i1, i2;
47

48
    for (var i = 0; i < output.length; i += 3) {
3✔
49
      if (mesh.indices != null) {
1✔
50
        i0 = mesh.indices![i];
2✔
51
        i1 = mesh.indices![i + 1];
3✔
52
        i2 = mesh.indices![i + 2];
3✔
53
      } else {
54
        i0 = i;
55
        i1 = i + 1;
×
56
        i2 = i + 2;
×
57
      }
58

59
      barycentricCoords[i] = b0;
1✔
60
      barycentricCoords[i + 1] = b1;
2✔
61
      barycentricCoords[i + 2] = b2;
2✔
62

63
      // Copy the remaining attributes over
64
      for (var j = 0; j < srcAttribs.length; ++j) {
3✔
65
        destAttribs[j][i] = srcAttribs[j][i0];
4✔
66
        destAttribs[j][i + 1] = srcAttribs[j][i1];
5✔
67
        destAttribs[j][i + 2] = srcAttribs[j][i2];
5✔
68
      }
69
    }
70

71
    return output;
72
  }
73
}
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