Code Monkey home page Code Monkey logo

pyobb's People

Contributors

genevievebuckley avatar pboechat 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pyobb's Issues

How to visualize with obb

Hi, I am new learner of 3d geometry. Your tool helps me a a lot to get oriented bounding box. But I don't know how to visualize it like what to show in the README.md. Could you give me some hints or url sources to guide me how to visualize it?

Local frame of reference or global frame of reference

For all these following:
centroid: the OBB center
min: the OBB point with the smallest XYZ components
max: the OBB point with the largest XYZ components
points: the 8 points of the OBB
extents: the extents of the OBB in the XYZ-axis
Are they based on the local frame of reference, or the global frame of reference?
I am kinda confused.
And should I use rotation.T as the base vector of OBB, and take the centroid as the origin of the local frame of reference?

Incorrect obb vertex

snapshot

I noticed that in certain cases, one of the vertices is wrong.

From the code below, I have represented in yellow an array of coordinates of points while the vertices of the obb are green.
spond to the points I got from the obb object constructed from the yellow dots
The last vertex is not correct.

Please find attached a MWE
Sorry for the length of the code.

`
import numpy as np
from numpy import array
from mayavi import mlab
from pyobb.obb import OBB
Pts =
array([[ 0.3 , 0.6012 , -0.5 ],
[ 0.22981333, 0.66547876, -0.5 ],
[ 0.05209445, 0.69968078, -0.5 ],
[-0.15 , 0.68780254, -0.5 ],
[-0.28190779, 0.63540201, -0.5 ],
[-0.28190779, 0.56699799, -0.5 ],
[-0.15 , 0.51459746, -0.5 ],
[ 0.05209445, 0.50271922, -0.5 ],
[ 0.22981333, 0.53692124, -0.5 ],
[ 0.3 , 0.6012 , -0.5 ],
[ 0.3 , 0.6012 , -0.36200274],
[ 0.22981333, 0.66547876, -0.36200274],
[ 0.05209445, 0.69968078, -0.36200274],
[-0.15 , 0.68780254, -0.36200274],
[-0.28190779, 0.63540201, -0.36200274],
[-0.28190779, 0.56699799, -0.36200274],
[-0.15 , 0.51459746, -0.36200274],
[ 0.05209445, 0.50271922, -0.36200274],
[ 0.22981333, 0.53692124, -0.36200274],
[ 0.3 , 0.6012 , -0.36200274],
[ 0.3 , 0.6012 , -0.2441701 ],
[ 0.22981333, 0.66547876, -0.2441701 ],
[ 0.05209445, 0.69968078, -0.2441701 ],
[-0.15 , 0.68780254, -0.2441701 ],
[-0.28190779, 0.63540201, -0.2441701 ],
[-0.28190779, 0.56699799, -0.2441701 ],
[-0.15 , 0.51459746, -0.2441701 ],
[ 0.05209445, 0.50271922, -0.2441701 ],
[ 0.22981333, 0.53692124, -0.2441701 ],
[ 0.3 , 0.6012 , -0.2441701 ],
[ 0.3 , 0.6012 , -0.14074074],
[ 0.22981333, 0.66547876, -0.14074074],
[ 0.05209445, 0.69968078, -0.14074074],
[-0.15 , 0.68780254, -0.14074074],
[-0.28190779, 0.63540201, -0.14074074],
[-0.28190779, 0.56699799, -0.14074074],
[-0.15 , 0.51459746, -0.14074074],
[ 0.05209445, 0.50271922, -0.14074074],
[ 0.22981333, 0.53692124, -0.14074074],
[ 0.3 , 0.6012 , -0.14074074],
[ 0.3 , 0.6012 , -0.04595336],
[ 0.22981333, 0.66547876, -0.04595336],
[ 0.05209445, 0.69968078, -0.04595336],
[-0.15 , 0.68780254, -0.04595336],
[-0.28190779, 0.63540201, -0.04595336],
[-0.28190779, 0.56699799, -0.04595336],
[-0.15 , 0.51459746, -0.04595336],
[ 0.05209445, 0.50271922, -0.04595336],
[ 0.22981333, 0.53692124, -0.04595336],
[ 0.3 , 0.6012 , -0.04595336],
[ 0.3 , 0.6012 , 0.04595336],
[ 0.22981333, 0.66547876, 0.04595336],
[ 0.05209445, 0.69968078, 0.04595336],
[-0.15 , 0.68780254, 0.04595336],
[-0.28190779, 0.63540201, 0.04595336],
[-0.28190779, 0.56699799, 0.04595336],
[-0.15 , 0.51459746, 0.04595336],
[ 0.05209445, 0.50271922, 0.04595336],
[ 0.22981333, 0.53692124, 0.04595336],
[ 0.3 , 0.6012 , 0.04595336],
[ 0.3 , 0.6012 , 0.14074074],
[ 0.22981333, 0.66547876, 0.14074074],
[ 0.05209445, 0.69968078, 0.14074074],
[-0.15 , 0.68780254, 0.14074074],
[-0.28190779, 0.63540201, 0.14074074],
[-0.28190779, 0.56699799, 0.14074074],
[-0.15 , 0.51459746, 0.14074074],
[ 0.05209445, 0.50271922, 0.14074074],
[ 0.22981333, 0.53692124, 0.14074074],
[ 0.3 , 0.6012 , 0.14074074],
[ 0.3 , 0.6012 , 0.2441701 ],
[ 0.22981333, 0.66547876, 0.2441701 ],
[ 0.05209445, 0.69968078, 0.2441701 ],
[-0.15 , 0.68780254, 0.2441701 ],
[-0.28190779, 0.63540201, 0.2441701 ],
[-0.28190779, 0.56699799, 0.2441701 ],
[-0.15 , 0.51459746, 0.2441701 ],
[ 0.05209445, 0.50271922, 0.2441701 ],
[ 0.22981333, 0.53692124, 0.2441701 ],
[ 0.3 , 0.6012 , 0.2441701 ],
[ 0.3 , 0.6012 , 0.36200274],
[ 0.22981333, 0.66547876, 0.36200274],
[ 0.05209445, 0.69968078, 0.36200274],
[-0.15 , 0.68780254, 0.36200274],
[-0.28190779, 0.63540201, 0.36200274],
[-0.28190779, 0.56699799, 0.36200274],
[-0.15 , 0.51459746, 0.36200274],
[ 0.05209445, 0.50271922, 0.36200274],
[ 0.22981333, 0.53692124, 0.36200274],
[ 0.3 , 0.6012 , 0.36200274],
[ 0.3 , 0.6012 , 0.5 ],
[ 0.22981333, 0.66547876, 0.5 ],
[ 0.05209445, 0.69968078, 0.5 ],
[-0.15 , 0.68780254, 0.5 ],
[-0.28190779, 0.63540201, 0.5 ],
[-0.28190779, 0.56699799, 0.5 ],
[-0.15 , 0.51459746, 0.5 ],
[ 0.05209445, 0.50271922, 0.5 ],
[ 0.22981333, 0.53692124, 0.5 ],
[ 0.3 , 0.6012 , 0.5 ]])

mlab.points3d(Pts[:,0],
Pts[:,1],
Pts[:,2],
color = (1.,1.,0.))
obb = OBB.build_from_points(Pts)
"""
get the vertices of the obb
"""
vertices = np.concatenate(obb.points).reshape(-1,3)
mlab.points3d(vertices[:,0],
vertices[:,1],
vertices[:,2],
color = (0.,1.,0.))
`

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.