Skip to content

Instantly share code, notes, and snippets.

View Tehsurfer's full-sized avatar

Jesse Khorasanee Tehsurfer

View GitHub Profile
@Tehsurfer
Tehsurfer / moveNodeToMesh.py
Last active October 24, 2018 01:49
Opencmiss mesh solver for a defined direction
def moveNode(region, nodekey, plane_normal=[0, 1, 0], cache=none):
# moveNode uses dot products combined with opencmiss' evaluateMeshLocation function to solve where a point lies along a given normal (line in 3D).
# usage: Please not that this solver assumes that the user knows where the solution should be in one dimension,
# for example: Where is the closest mesh point at x=0 (normal=[1,0,0]) starting at [1,3,2]?
# Inputs:
# region: the region you wish to solve in (must contain a mesh and a the node you wish to move)
# nodekey: identifier of the node we wish to project onto the mesh
# plane_normal: the direction we wish to project the node onto the mesh