Skip to main content

Find edge-to-edge and edge-to-surface joints of planar polygons

Project description

jointfinder

This package finds edge-to-edge and edge-to-surface joints of planar polygons.

Quickstart

This package accepts list of dictionaries as input. Each dictionary should have these elements:

  • name part name
  • points sequential points that make up a polygon in 3D cartesian coordinates, all points must be on a same plane (minimum 3 unique points per polygon)
  • plane (optional) plane unit vector (left hand thumb direction, sequential points being the fingers)
  • depth (optional, default: 0) polygon's thickness All scalars must be integer or float
polygons = []

# polygon name is #42
polygons += [{'name': 42, 
              'points': [[0, 0, 0], [0, 20, 0], [20, 20, 0], [20, 0, 0]]}]

# polygon name is #43
polygons += [{'name': 43, 
              'points': [[20, 0, 0], [20, 20, 0], [40, 20, 0], [40, 0, 0]]}]

polygons

two squares list of dictionaries

Create JointFinder object. polygons input is tabulated as pandas dataframe. Accessible as object property df. Refer to pandas for more information on pandas.

from jointfinder import jf

JF = jf.JointFinder(polygons)
JF.df

two squares df

Use plotting tool from util to view input polygons.

from jointfinder import util

util.plot(JF.df)

two squares plot

Use find_joint() object function to run for solution.

joints = JF.find_joint()
joints

two squares output

Output is pandas dataframe. Suffices A and B in columns indicate indices, which polygon makes joint with which other polygon. Polygon A's edge makes a joint with polygon B's edge or surface. Each dataframe row indicates where a joint exists (x0, y0, z0 to x1, y1, z1). Column type indicates if it is a butt joint (1: edge to edge) or t-joint (0: edge to surface).

Dataframe as Input

Alternatively, users can create their dataframe themselves (or parse to from other sources) to input directly to JointFinder as it also accepts pandas dataframe as input (in addition to list of dictionaries). Do take note that the format must follow convention of object property df.

To simulate, use util.create_dummy_block() for test dataframe.

df = util.create_dummy_parts()
util.plot(df)

one block plot

Similarly, create JointFinder object with test dataframe then run find_joint() object function.

JF = jf.JointFinder(df)
joints = JF.find_joint()
joints

one block output

Default test dataframe has three squares that make up a block with t-joints. To create more, pass number of rows and columns as x and y arguments to tile them.

E.g. util.create_dummy_block(x=2, y=1) creates blocks tiled in 2 x 1.

2x1 block plot

from jointfinder import jf, util

df = util.create_dummy_block(x=50, y=50)
JF = jf.JointFinder(df)
joints = JF.find_joint()
joints

50x50 block output

Handling Large Dataframe

It is advised to run the module's jf directly from shell or console to better benefit from computing concurrency. Prior to running, the dataframe location must be first pickled (made persistent). Alternatively, it may also be accessed from memory location which user must find out manually. Input system argument dpath to indicate where the pickled dataframe is or from memory. Output will be saved in path stated in tpath.

util.save_df(df, 'test.pkl')
!python -m jointfinder.jf dpath=test.pkl tpath=test_result.pkl

50x50 block output shell

As output is also pickled, use util.load_df() to load dataframe back to a variable. User may also export the result to other formats such as csv.

result = util.load_df('test_result.pkl')
result.to_csv('test_result.csv')

About

Beta version, v1.x.x, has limited features. Full release is from v1.2.0 onwards. Please visit https://github.com/SiDODOL/jointfinder after full release.

Singapore Institute of Technology. Email: zhiyung.tay@singaporetech.edu.sg; januwar.hadi@singaporetech.edu.sg

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

jointfinder-1.1.6-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file jointfinder-1.1.6-py3-none-any.whl.

File metadata

  • Download URL: jointfinder-1.1.6-py3-none-any.whl
  • Upload date:
  • Size: 28.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for jointfinder-1.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 211915a18b9f09523fe3f39b2a2a0762a1fb342b647f7b7eb7bfa85c075ffad5
MD5 51e9e8771e72ee9b2df92f03d712830f
BLAKE2b-256 91c68c6759baa2f0dd75d5613ee29841b40ee96fe32ce341b19b3fd9699f3fe6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page