forked from kanzure/python-brlcad
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
51 additions
and
5 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
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,39 @@ | ||
""" | ||
Python wrapper for the Particle primitive of BRL-CAD. | ||
""" | ||
|
||
from base import Primitive | ||
from brlcad.vmath import Vector | ||
|
||
|
||
class Particle(Primitive): | ||
|
||
def __init__(self, name, base=(0, 0, 0), height=(0, 0, 1), r_base=0.5, r_end=0.2, copy=False): | ||
Primitive.__init__(self, name=name) | ||
self.base = Vector(base, copy=copy) | ||
self.height = Vector(height, copy=copy) | ||
self.r_base = r_base | ||
self.r_end = r_end | ||
|
||
def __repr__(self): | ||
return "{}({}, base={}, height={}, r_base={}, r_end={})".format( | ||
self.__class__.__name__, self.name, repr(self.base), repr(self.height), self.r_base, self.r_end | ||
) | ||
|
||
def update_params(self, params): | ||
params.update({ | ||
"base": self.base, | ||
"height": self.height, | ||
"r_base": self.r_base, | ||
"r_end": self.r_end, | ||
}) | ||
|
||
@staticmethod | ||
def from_wdb(name, data): | ||
return Particle( | ||
name=name, | ||
base=data.part_V, | ||
height=data.part_H, | ||
r_base=data.part_vrad, | ||
r_end=data.part_hrad, | ||
) |
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
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
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