generic_vector_tools 1.0.7

  • Example
  • Installing
  • Versions
  • 0

generic_vector_tools #

A library for Vectors of arbitrary length, and arbitrary element types. Makes use of operator overloads of elements to perform operations.

Usage #

A simple usage example:

import 'package:generic_vector_tools/generic_vector_tools.dart';

main() {
  V<double> position = new V<double>([0.0, 10.0]);
  V positions = new V([position, position + 10.0, position + 25.0]);
  V morePositions = new V([position, position + 90.0, position + 11.1]);

  V yetMorePositions = positions + morePositions;

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Changelog #

0.0.1 #

  • Initial version, created by Stagehand

1.0.0 #

  • Initial publish version, basic features and unit tests.

1.0.1 #

  • Added some documentation

1.0.2 #

  • Added negate methods to V and M
  • Added sum(), sumRecursive(), any() and every() to V

1.0.3 #

  • SelfResolve
  • Split unit tests into separate files
  • Try and convert basic constructor input to list
  • docs for M
  • generic constructor for m and unit tests
  • zip uses generic constructor

1.0.4 #

  • V2 now extends V
  • explicitly set V list sizes where relevant

1.0.5 #

  • removed the type checking for V.generic, it caused issues when compiled to js

1.0.6 #

  • fixed unit tests not working in checked mode

1.0.7 #

  • Unit tests make use of the test package (pub run test...) rather than a custom command.
  • More flexible V2 overloads.


// Copyright (c) 2015, Ben Sheron. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

library generic_vector_tools.example;

import 'package:generic_vector_tools/generic_vector_tools.dart';

main() {
  // Create a vector of two doubles - a position
  V<double> position = new V<double>([0.0, 10.0]);

  // Create a vector of positions
  V<V<double>> positions =
      new V<V<double>>([position, position + 10.0, position + 25.0]);

  // Calculate a matrix of distances between all positions
  V distances = positions.Resolve(positions, (V p1, V p2) => p2 - p1);

  // M class is a wrapper around vector with some methods suited to 2D, like printing:
  M distanceMatrix = new M.FromV(distances);

  // We can also easily compute the magnitude of the distances (or any other function over elements)
  M magnitudes = new M.FromV(
      positions.Resolve(positions, (V p1, V p2) => (p2 - p1).Magnitude));

  // For easy viewing:
  print("magnitudes (rounded for printing):");
  magnitudes.Print(round: true);

  // And easily apply functions over the matrix
  M magnitudesCubedThenRounded = magnitudes.MapF((e) => (e * e * e).round());

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  generic_vector_tools: ^1.0.7

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:generic_vector_tools/generic_vector_tools.dart';
Version Uploaded Documentation Archive
1.0.7 Jul 11, 2016 Go to the documentation of generic_vector_tools 1.0.7 Download generic_vector_tools 1.0.7 archive
1.0.6 Apr 3, 2016 Go to the documentation of generic_vector_tools 1.0.6 Download generic_vector_tools 1.0.6 archive
1.0.5 Apr 2, 2016 Go to the documentation of generic_vector_tools 1.0.5 Download generic_vector_tools 1.0.5 archive
1.0.4 Feb 14, 2016 Go to the documentation of generic_vector_tools 1.0.4 Download generic_vector_tools 1.0.4 archive
1.0.3 Feb 7, 2016 Go to the documentation of generic_vector_tools 1.0.3 Download generic_vector_tools 1.0.3 archive
1.0.2 Feb 3, 2016 Go to the documentation of generic_vector_tools 1.0.2 Download generic_vector_tools 1.0.2 archive
1.0.1 Feb 3, 2016 Go to the documentation of generic_vector_tools 1.0.1 Download generic_vector_tools 1.0.1 archive
1.0.0 Jan 29, 2016 Go to the documentation of generic_vector_tools 1.0.0 Download generic_vector_tools 1.0.0 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <2.0.0