GithubHelp home page GithubHelp logo

lace / vg Goto Github PK

View Code? Open in Web Editor NEW
120.0 120.0 15.0 345 KB

Vector-geometry toolbelt for 3D points and vectors

Home Page: https://vgpy.dev/

License: BSD 2-Clause "Simplified" License

Python 99.77% Shell 0.23%
3d-points 3d-vectors geometry linear-algebra numpy shortcuts toolbelt vector vectors

vg's Introduction

lace

version python versions version

Polygonal mesh library developed at Body Labs.

This library is deprecated. The primary successor is lacecore:

  • Provides polygonal meshes optimized for cloud computation.
  • Supports triangles and quads.
  • Provides OBJ loading via the obj extra.

Several other mesh-related libraries were broken out from this package and blmath:

  • polliwog provides low-level functions for working with triangles, optimized for cloud computation.
  • entente provides functions for working with meshes having vertexwise correspondence.
  • proximity provides proximity queries.
  • hobart obtains planar cross sections.
  • tri-again provides simple 3D scenegraphs for debugging meshes, polylines, and points.
  • meshlab-pickedpoints loads and saves MeshLab picked point (.pp) files.

For batteries-included prototyping, Trimesh is recommended as an alternative.

Installation

Install dependencies

Mac OS:

brew update && brew install boost
pip install numpy==1.13.1
pip install lace

Linux:

apt-get install -y --no-install-recommends libsuitesparse-dev libboost-dev
pip install numpy==1.13.1
pip install lace

Docker:

docker build .

Install the library

pip install lace

Development

pip install -r requirements_dev.txt
pip install -e .
rake test
rake lint

Acknowledgements

This library was refactored from legacy code at Body Labs by Alex Weiss, with portions by Eric Rachlin, Paul Melnikow, Victor Alvarez, and others. It was extracted from the Body Labs codebase and open-sourced by Guillaume Marceau. In 2018 it was forked by Paul Melnikow and published as metabolace. Thanks to a repository and package transfer from Body Labs, the fork has been merged back into the original.

License

The project is licensed under the two-clause BSD license.

This project uses the RPly library to read and write PLY files, by Diego Nehab, IMPA, distributed under the MIT License.

vg's People

Contributors

ageron avatar dependabot-preview[bot] avatar dependabot[bot] avatar jaime02 avatar jlevin avatar lgtm-com[bot] avatar paulmelnikow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vg's Issues

Clarify what goes in `vg` vs `polliwog`

Since there is a closely related library, polliwog which does a lot of computational geometry, it's useful to clarify what belongs here vs. there.

Accordingly, the idea is to clarify this library's purpose:

A vector-geometry toolbelt for dealing with 3D points and vectors

and say that anything more complicated is general computational geometry, and goes in polliwog.

In particular, transformation matrices will be scoped to polliwog.

Accordingly, the matrix functions will be removed in the next major release.

Refs:

Error using signed_angle with vector array

Hello!

I am calling

angles = vg.signed_angle(vec1_array.T, points.T, look, units='rad')

with shapes

('points', (3, 8))
('vec1_array', (3, 8))
('look', (3, 1))

However, I get the error:

Traceback (most recent call last):
  File "./extract_fe_pictures.py", line 113, in <module>
    test_code('skywalker_2013_mod', plot=False, interactive=False, export_path='.', verbose=False)
  File "./extract_fe_pictures.py", line 28, in test_code
    safe_poly.plot()
  File "/home/george/ros_workspaces/uav_ftc/src/uav_ftc/src/uav_ftc/polytope_utils.py", line 1271, in plot
    face_points = self._get_face_points(temp_polytope)
  File "/home/george/ros_workspaces/uav_ftc/src/uav_ftc/src/uav_ftc/polytope_utils.py", line 853, in _get_face_points
    angles = vg.signed_angle(vec1_array.T, points.T, look, units='rad')
  File "/usr/local/lib/python2.7/dist-packages/vg/core.py", line 297, in signed_angle
    return sign * angle(v1, v2, look, units=units)
  File "/usr/local/lib/python2.7/dist-packages/vg/core.py", line 251, in angle
    v1, v2 = [reject(v, from_v=look) for v in (v1, v2)]
  File "/usr/local/lib/python2.7/dist-packages/vg/core.py", line 125, in reject
    return vector - project(vector, onto=from_v)
  File "/usr/local/lib/python2.7/dist-packages/vg/core.py", line 92, in project
    return scalar_projection(vector, onto=onto)[:, np.newaxis] * normalize(onto)
  File "/usr/local/lib/python2.7/dist-packages/vg/core.py", line 112, in scalar_projection
    check(locals(), "onto", (k, 3))
  File "/usr/local/lib/python2.7/dist-packages/vg/shape.py", line 93, in check
    return check_value(locals_namespace[name], shape, name=name)
  File "/usr/local/lib/python2.7/dist-packages/vg/shape.py", line 54, in check_value
    raise ValueError("{} with shape {}; got {}".format(preamble, shape, a.shape))
ValueError: onto must be an array with shape (8, 3); got (3, 1)

I believe I have set the dimensions correctly.
Am I missing something?

Thanks!

Add a compatibility layer

Since Python modules are installed in a global namespace, breaking changes to APIs can be very difficult to deal with, especially in a toolbelt like this one, since it's intended to be used by whole ecosystems of packages. If a breaking change is introduced here it needs to be updated at every point in the dependency tree, all at once, which is challenging.

I don't want to freeze the API forever, so instead the solution should be to provide a stable compatibility layer for libraries. For example, instead of import vg, a library would use import v1 as vg from vg. That way, libraries will be inured to future breaking changes, so long as 1.x or later version is used.

Convenience for application code means that import vg will keep working, and use the latest version.

It could also be possible to import next as vg from vg to provide experimental APIs before they've reached a point of stability.

I'd like to include this before the next major version is released.

Error when installing the package

I get this error while installing the module:

C:\WINDOWS\system32>pip install vg
Collecting vg
  Using cached https://files.pythonhosted.org/packages/34/42/aad07165a66eb402ec60d2e40640b585ca56b748b42e9923c1242be4d06b/vg-1.2.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\reas\AppData\Local\Temp\pip-install-2c8clwqs\vg\setup.py", line 10, in <module>
        readme = f.read()
      File "c:\program files (x86)\python37-32\lib\encodings\cp1252.py", line 23, in decode
        return codecs.charmap_decode(input,self.errors,decoding_table)[0]
    UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 1618: character maps to <undefined>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.