Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
primitive primitives and geometries for part mating
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/python | ||
|
||
import yaml | ||
import numpy | ||
import primitives | ||
|
||
class Circle(primitives.PrimitiveShape): | ||
'''generic circle. units are meters.''' | ||
yaml_tag = '!circle' | ||
def __init__(self,radius=1,x=0,y=0,z=0,i=numpy.array([0,0,0]),j=numpy.array([0,0,0]),k=numpy.array([0,0,0])): | ||
'''xyz are positions. ijk are unit vectors describing the local coordinate frame.''' | ||
super(x=x,y=y,z=z,i=i,j=j,k=k) | ||
self.radius = radius | ||
|
||
class Square(primitives.PrimitiveShape): | ||
'''generic square. units are meters.''' | ||
yaml_tag = '!square' | ||
def __init__(self,width=1,height=1,x=0,y=0,z=0,i=numpy.array([0,0,0]),j=numpy.array([0,0,0]),k=numpy.array([0,0,0])): | ||
super(x=x,y=y,z=z,i=i,j=j,k=k) | ||
self.width = width | ||
self.height = height |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/python | ||
|
||
import yaml | ||
import numpy | ||
|
||
class PrimitiveShape(yaml.YAMLObject): | ||
'''generic primitive shape wrapper for pythonOCC/OpenCASCADE and friends''' | ||
yaml_tag = '!PrimitiveShape' #not this matters much | ||
def __init__(self,x=0,y=0,z=0,i=numpy.array([0,0,0]),j=numpy.array([0,0,0]),k=numpy.array([0,0,0])): | ||
self.x = x | ||
self.y = y | ||
self.z = z | ||
self.i = i | ||
self.j = j | ||
self.k = k |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters