Name | VisualShape3D JSON |
Version |
1.1.3
JSON |
| download |
home_page | None |
Summary | None |
upload_time | 2024-05-26 14:31:58 |
maintainer | None |
docs_url | None |
author | Liqun He |
requires_python | None |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# VisualShape3D
## VisualShape3D
VisualShape3D is a simple library of geometry designed to quickly build a 3D model with its functions. It starts with creating a viewport at first, followed by adding each 3D shape to it, and finally showing them all at once. There are three shapes: Point, PolyLine, and Polygon. A 3D polygon is created by first defining a 2D shape on the yz plane and then transforms it with both new position and orientation, while its bottom is limited to motion in XY plane.
As seen in the following examples, VisualShape3D is capable of calculating line intersections with polygons, as well as rotating/translating a shape to building a 3D body.
## Core Features
* Shapes : Point, Polylines, and Polygon.
* It can check whether or not a point is inside a segment or polygon.
* __hash__ and __eq__, also overloaded for ordering and logical equal the three shapes.
* For a shape, __neg__ is overloaded for one to get thevertices in the order viewed from its other side.
## Requirements
* [Python](http://www.python.org) 3
* Matplotlib is needed.
## Documentation
To be continued.
## Installation
```bash
pip install VisualShape3D
```
## Usage
* case 1 : building a box.
from VisualShape3D.VisualModels import VisualShape3D as vs3d
from VisualShape3D.geometry import Shape
A,B,C = 6,6,3
P1,P2,P3,P4 = (A,0,0),(A,B,0),(A,B,C),(A,0,C)
P5,P6,P7,P8 = (0,0,0),(0,B,0),(0,B,C),(0,0,C)
V = [P1,P2,P3,P4,P5,P6,P7,P8]
shape1 = Shape("Polygon",vertices = [V[0],V[1],V[2],V[3]])
shape2 = Shape("Polygon",vertices = [V[1],V[2],V[6],V[5]])
shape3 = Shape("Polygon",vertices = [V[5],V[4],V[7],V[6]])
shape4 = Shape("Polygon",vertices = [V[4],V[0],V[3],V[7]])
shape5 = Shape("Polygon",vertices = [V[3],V[2],V[6],V[7]])
shape6 = Shape("Polygon",vertices = [V[4],V[5],V[1],V[0]])
body = vs3d({'facecolor':'yellow','alpha':0.7})
body.add_shape(shape1,{'facecolor':'red','alpha':0.7})
body.add_shape(shape2)
body.add_shape(shape3)
body.add_shape(shape4)
body.add_shape(shape5)
body.add_shape(shape6)
body.show()
* case 2 : rotating a shape
from VisualShape3D.VisualModels import VisualShape3D as vs3d
from VisualShape3D.geometry import Shape
A,B,C = 6,6,3
P1,P2,P3,P4 = (A,0,0),(A,B,0),(A,B,C),(A,0,C)
P5,P6,P7,P8 = (0,0,0),(0,B,0),(0,B,C),(0,0,C)
V = [P1,P2,P3,P4,P5,P6,P7,P8]
shape1 = Shape("Polygon",vertices = [V[0],V[1],V[2],V[3]])
shape11 = shape1
shape12 = shape11.transform(angles = (90,0))
shape13 = shape12.transform(angles = (90,0))
shape14 = shape13.transform(angles = (90,0))
body = vs3d({'facecolor':'yellow','alpha':0.7})
body.add_shape(shape11,{'facecolor':'red','alpha':0.7})
body.add_shape(shape12)
body.add_shape(shape13)
body.add_shape(shape14)
body.show()
* case 3 : roating and translating a shape
from VisualShape3D.VisualModels import VisualShape3D as vs3d
from VisualShape3D.geometry import Shape
shape11 = shape1
shape12 = shape11.transform(to = shape11[1],angles = (90,0))
shape13 = shape12.transform(to = shape12[1],angles = (90,0))
shape14 = shape13.transform(to = shape13[1],angles = (90,0))
body = vs3d({'facecolor':'yellow','alpha':0.7})
body.add_shape(shape11,{'facecolor':'red','alpha':0.7})
body.add_shape(shape12)
body.add_shape(shape13)
body.add_shape(shape14)
body.show()
## Change Log
[changelog.md](changelog.md)
## License
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
## Contact
heliqun@ustc.edu.cn
Raw data
{
"_id": null,
"home_page": null,
"name": "VisualShape3D",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Liqun He",
"author_email": "heliqun2007@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/a6/5b/4a8bbb388239f1e41f4b5d0340b4e2e63783e265fca52c3af23fdc11ee21/VisualShape3D-1.1.3.tar.gz",
"platform": null,
"description": "# VisualShape3D\r\n\r\n## VisualShape3D\r\n\r\nVisualShape3D is a simple library of geometry designed to quickly build a 3D model with its functions. It starts with creating a viewport at first, followed by adding each 3D shape to it, and finally showing them all at once. There are three shapes: Point, PolyLine, and Polygon. A 3D polygon is created by first defining a 2D shape on the yz plane and then transforms it with both new position and orientation, while its bottom is limited to motion in XY plane. \r\n\r\nAs seen in the following examples, VisualShape3D is capable of calculating line intersections with polygons, as well as rotating/translating a shape to building a 3D body.\r\n\r\n## Core Features\r\n* Shapes : Point, Polylines, and Polygon.\r\n* It can check whether or not a point is inside a segment or polygon.\r\n* __hash__ and __eq__, also overloaded for ordering and logical equal the three shapes.\r\n* For a shape, __neg__ is overloaded for one to get thevertices in the order viewed from its other side.\r\n\r\n## Requirements\r\n\r\n* [Python](http://www.python.org) 3 \r\n* Matplotlib is needed.\r\n\r\n## Documentation\r\n\r\nTo be continued.\r\n\r\n## Installation\r\n```bash\r\npip install VisualShape3D\r\n```\r\n\r\n## Usage \r\n\r\n* case 1 : building a box.\r\nfrom VisualShape3D.VisualModels import VisualShape3D as vs3d \r\nfrom VisualShape3D.geometry import Shape\r\nA,B,C = 6,6,3 \r\nP1,P2,P3,P4 = (A,0,0),(A,B,0),(A,B,C),(A,0,C) \r\nP5,P6,P7,P8 = (0,0,0),(0,B,0),(0,B,C),(0,0,C) \r\nV = [P1,P2,P3,P4,P5,P6,P7,P8] \r\nshape1 = Shape(\"Polygon\",vertices = [V[0],V[1],V[2],V[3]]) \r\nshape2 = Shape(\"Polygon\",vertices = [V[1],V[2],V[6],V[5]]) \r\nshape3 = Shape(\"Polygon\",vertices = [V[5],V[4],V[7],V[6]]) \r\nshape4 = Shape(\"Polygon\",vertices = [V[4],V[0],V[3],V[7]]) \r\nshape5 = Shape(\"Polygon\",vertices = [V[3],V[2],V[6],V[7]]) \r\nshape6 = Shape(\"Polygon\",vertices = [V[4],V[5],V[1],V[0]])\r\n\r\nbody = vs3d({'facecolor':'yellow','alpha':0.7}) \r\nbody.add_shape(shape1,{'facecolor':'red','alpha':0.7}) \r\nbody.add_shape(shape2) \r\nbody.add_shape(shape3) \r\nbody.add_shape(shape4) \r\nbody.add_shape(shape5) \r\nbody.add_shape(shape6) \r\nbody.show()\r\n\r\n* case 2 : rotating a shape \r\nfrom VisualShape3D.VisualModels import VisualShape3D as vs3d \r\nfrom VisualShape3D.geometry import Shape\r\nA,B,C = 6,6,3 \r\nP1,P2,P3,P4 = (A,0,0),(A,B,0),(A,B,C),(A,0,C) \r\nP5,P6,P7,P8 = (0,0,0),(0,B,0),(0,B,C),(0,0,C) \r\nV = [P1,P2,P3,P4,P5,P6,P7,P8] \r\nshape1 = Shape(\"Polygon\",vertices = [V[0],V[1],V[2],V[3]])\r\n\r\nshape11 = shape1 \r\nshape12 = shape11.transform(angles = (90,0)) \r\nshape13 = shape12.transform(angles = (90,0)) \r\nshape14 = shape13.transform(angles = (90,0))\r\n\r\nbody = vs3d({'facecolor':'yellow','alpha':0.7}) \r\nbody.add_shape(shape11,{'facecolor':'red','alpha':0.7}) \r\nbody.add_shape(shape12) \r\nbody.add_shape(shape13) \r\nbody.add_shape(shape14) \r\nbody.show()\r\n\r\n* case 3 : roating and translating a shape \r\nfrom VisualShape3D.VisualModels import VisualShape3D as vs3d\r\nfrom VisualShape3D.geometry import Shape\r\n\r\nshape11 = shape1 \r\nshape12 = shape11.transform(to = shape11[1],angles = (90,0)) \r\nshape13 = shape12.transform(to = shape12[1],angles = (90,0)) \r\nshape14 = shape13.transform(to = shape13[1],angles = (90,0))\r\nbody = vs3d({'facecolor':'yellow','alpha':0.7}) \r\nbody.add_shape(shape11,{'facecolor':'red','alpha':0.7}) \r\nbody.add_shape(shape12) \r\nbody.add_shape(shape13) \r\nbody.add_shape(shape14) \r\nbody.show()\r\n\r\n\r\n## Change Log\r\n\r\n[changelog.md](changelog.md)\r\n\r\n## License\r\n\r\n This program is free software: you can redistribute it and/or modify\r\n it under the terms of the GNU General Public License as published by\r\n the Free Software Foundation, either version 3 of the License, or\r\n (at your option) any later version.\r\n\r\n This program is distributed in the hope that it will be useful,\r\n but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r\n GNU General Public License for more details.\r\n\r\n You should have received a copy of the GNU General Public License\r\n along with this program. If not, see <http://www.gnu.org/licenses/>.\r\n\r\n## Contact\r\nheliqun@ustc.edu.cn\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": null,
"version": "1.1.3",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a65b4a8bbb388239f1e41f4b5d0340b4e2e63783e265fca52c3af23fdc11ee21",
"md5": "399c5067ee66fbe77e6bfbdc0a3d3fda",
"sha256": "3dbdad678364f1710212400f95c94d89e2f68cc322abbf68f3af5a4b049745aa"
},
"downloads": -1,
"filename": "VisualShape3D-1.1.3.tar.gz",
"has_sig": false,
"md5_digest": "399c5067ee66fbe77e6bfbdc0a3d3fda",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 32751,
"upload_time": "2024-05-26T14:31:58",
"upload_time_iso_8601": "2024-05-26T14:31:58.281001Z",
"url": "https://files.pythonhosted.org/packages/a6/5b/4a8bbb388239f1e41f4b5d0340b4e2e63783e265fca52c3af23fdc11ee21/VisualShape3D-1.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-26 14:31:58",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "visualshape3d"
}