Skip to content

Commit

Permalink
Merge branch 'master' into blender_2.77_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pherbers committed Jul 20, 2016
2 parents 83ed355 + 0cc4552 commit 71821e6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,22 @@ Otherwise, normal-, Euclidean- and random-based mapping are available.
Installation
------------

1. Download the latest official release ([a complete list can be found here](https://github.com/MartinPyka/Parametric-Anatomical-Modeling/releases)) or get a snapshot of [this GIT repository](https://github.com/MartinPyka/Parametric-Anatomical-Modeling)

2. Install the pam-folder as Add-On in Blender ([how to install an Add-On](http://wiki.blender.org/index.php/Doc:2.6/Manual/Extensions/Python/Add-Ons)). You can, for example, copy the pam-folder into the 2.X/scripts/addon-folder of your Blender version. If you downloaded the ZIP-file, you must only install the pam-folder as addon for Blender

3. In Blender, go to preferences - addons, search for PAM and activate it (optionally click on 'Save Preferences')

4. In the 3d view a new panel should appear on the left side, called "PAM". This panel contains function to load and save connectivity data and to visualize them.
Automatic installation:
1. Download the [latest release](https://github.com/MartinPyka/Parametric-Anatomical-Modeling/releases) as a zip file
2. Open up the Add-on Preferences screen (File -> User Preferences -> Add-ons)
3. Click `Install from File` and choose the downloaded zip
4. Make sure the add-on is activated in the list of add-ons
5. Click `Save User Settings` to always load the add-on on startup

Manual installation:
1. Clone the [git repository](https://github.com/MartinPyka/Parametric-Anatomical-Modeling) to your computer
2. Copy the folder `pam` to Blenders add-on folder
- On Windows 7 and above, the add-on folder is located in `C:\Users\%username%\AppData\Roaming\Blender Foundation\Blender\2.7x\scripts\addons`
- On Linux, the add-on folder is located in `/home/$user/.config/blender/$version/scripts/addons`
3. Start up Blender and activate the add-on in the Add-on Preferences (File -> User Preferences -> Add-ons)
5. Click `Save User Settings` to always load the add-on on startup

In the 3d view three new panels should appear on the left side, called "PAM Mapping", "PAM Modeling" and "PAM Animate. These panels contains functions to load and save connectivity data and to visualize them.


Usage
Expand Down
3 changes: 1 addition & 2 deletions pam/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ def mapUVPointTo3d(obj_uv, uv_list, check_edges = False, cleanup=True):

for i in point_indices:
point = uv_list[i]
polygons = qtree.getPolygons(point)
for polygon in polygons:
for polygon in qtree.getPolygons(point):
uvs = polygon[0]
p3ds = polygon[1]

Expand Down
25 changes: 14 additions & 11 deletions pam/utils/quadtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,20 @@ def addPolygon(self, polygon):

def getPolygons(self, point):
"""Gives a list of all polygons in the quadtree that may contain the point"""
p = point
if p[0] < self.left or p[0] > self.right or p[1] < self.top or p[1] > self.bottom:
return []
else:
result = list(self.polygons)
if all(self.children):
result.extend(self.children[0].getPolygons(p))
result.extend(self.children[1].getPolygons(p))
result.extend(self.children[2].getPolygons(p))
result.extend(self.children[3].getPolygons(p))
return result
node = self
while True:
for polygon in node.polygons:
yield polygon
if not node.children[0]:
break
if point[0] < node.children[0].right:
c = 0
else:
c = 1
if point[1] > node.children[0].bottom:
c += 2
node = node.children[c]


def buildQuadtree(depth = 2, left = 0.0, top = 0.0, right = 1.0, bottom = 1.0):
"""Builds a new quadtree recursively with the given depth."""
Expand Down

0 comments on commit 71821e6

Please sign in to comment.