Freestyle Python API improvements - part 3.
Major API updates were made to address code review comments.
This revision mostly focuses on Python wrappers of C++ 0D and 1D elements (i.e.,
Interface0D and Interface1D, as well as their subclasses).
* Most getter/setter methods were reimplemented as attributes using PyGetSetDef.
Vector attributes are now implemented based on mathutils callbacks. Boolean
attributes now only accept boolean values.
* The __getitem__ method was removed and the Sequence protocol was used instead.
* The naming of methods and attributes was fixed to follow the naming conventions
of the Blender Python API (i.e., lower case + underscores for methods and attributes,
and CamelCase for classes). Some naming inconsistency within the Freestyle Python
API was also addressed.
* The Freestyle API had a number of method names including prefix/suffix "A" and
"B", and their meanings were inconsistent (i.e., referring to different things
depending on the classes). The names with these two letters were replaced with
more straightforward names. Also some attribute names were changed so as to indicate
the type of the value (e.g., FEdge.next_fedge instead of FEdge.next_edge) in line
with other names explicitly indicating what the value is (e.g., SVertex.viewvertex).
* In addition, some code clean-up was done in both C++ and Python.
Notes:
In summary, the following irregular naming changes were made through this revision
(those resulting from regular changes of naming conventions are not listed):
- CurvePoint: {A,B} --> {first,second}_svertex
- FEdge: vertex{A,B} --> {first,second}_svertex
- FEdge: {next,previous}Edge --> {next,previous}_fedge
- FEdgeSharp: normal{A,B} --> normal_{right,left}
- FEdgeSharp: {a,b}FaceMark --> face_mark_{right,left}
- FEdgeSharp: {a,b}Material --> material_{right,left}
- FEdgeSharp: {a,b}MaterialIndex --> material_index_{right,left}
- FrsCurve: empty --> is_empty
- FrsCurve: nSegments --> segments_size
- TVertex: mate() --> get_mate()
- ViewEdge: fedge{A,B} --> {first,last}_fedge
- ViewEdge: setaShape, aShape --> occlude
- ViewEdge: {A,B} --> {first,last}_viewvertex
- ViewMap: getScene3dBBox --> scene_bbox
This commit is contained in:
@@ -44,10 +44,10 @@ class pyChainSilhouetteIterator(ChainingIterator):
|
|||||||
it = AdjacencyIterator(iter)
|
it = AdjacencyIterator(iter)
|
||||||
tvertex = self.getVertex()
|
tvertex = self.getVertex()
|
||||||
if type(tvertex) is TVertex:
|
if type(tvertex) is TVertex:
|
||||||
mateVE = tvertex.mate(self.getCurrentEdge())
|
mateVE = tvertex.get_mate(self.getCurrentEdge())
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
ve = it.getObject()
|
ve = it.getObject()
|
||||||
if(ve.getId() == mateVE.getId() ):
|
if ve.id == mateVE.id:
|
||||||
winner = ve
|
winner = ve
|
||||||
break
|
break
|
||||||
it.increment()
|
it.increment()
|
||||||
@@ -55,24 +55,24 @@ class pyChainSilhouetteIterator(ChainingIterator):
|
|||||||
## case of NonTVertex
|
## case of NonTVertex
|
||||||
natures = [Nature.SILHOUETTE,Nature.BORDER,Nature.CREASE,Nature.SUGGESTIVE_CONTOUR,Nature.VALLEY,Nature.RIDGE]
|
natures = [Nature.SILHOUETTE,Nature.BORDER,Nature.CREASE,Nature.SUGGESTIVE_CONTOUR,Nature.VALLEY,Nature.RIDGE]
|
||||||
for i in range(len(natures)):
|
for i in range(len(natures)):
|
||||||
currentNature = self.getCurrentEdge().getNature()
|
currentNature = self.getCurrentEdge().nature
|
||||||
if(natures[i] & currentNature):
|
if (natures[i] & currentNature) != 0:
|
||||||
count=0
|
count=0
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
visitNext = 0
|
visitNext = 0
|
||||||
oNature = it.getObject().getNature()
|
oNature = it.getObject().nature
|
||||||
if(oNature & natures[i] != 0):
|
if (oNature & natures[i]) != 0:
|
||||||
if(natures[i] != oNature):
|
if natures[i] != oNature:
|
||||||
for j in range(i):
|
for j in range(i):
|
||||||
if(natures[j] & oNature != 0):
|
if (natures[j] & oNature) != 0:
|
||||||
visitNext = 1
|
visitNext = 1
|
||||||
break
|
break
|
||||||
if(visitNext != 0):
|
if visitNext != 0:
|
||||||
break
|
break
|
||||||
count = count+1
|
count = count+1
|
||||||
winner = it.getObject()
|
winner = it.getObject()
|
||||||
it.increment()
|
it.increment()
|
||||||
if(count != 1):
|
if count != 1:
|
||||||
winner = None
|
winner = None
|
||||||
break
|
break
|
||||||
return winner
|
return winner
|
||||||
@@ -96,10 +96,10 @@ class pyChainSilhouetteGenericIterator(ChainingIterator):
|
|||||||
it = AdjacencyIterator(iter)
|
it = AdjacencyIterator(iter)
|
||||||
tvertex = self.getVertex()
|
tvertex = self.getVertex()
|
||||||
if type(tvertex) is TVertex:
|
if type(tvertex) is TVertex:
|
||||||
mateVE = tvertex.mate(self.getCurrentEdge())
|
mateVE = tvertex.get_mate(self.getCurrentEdge())
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
ve = it.getObject()
|
ve = it.getObject()
|
||||||
if(ve.getId() == mateVE.getId() ):
|
if ve.id == mateVE.id:
|
||||||
winner = ve
|
winner = ve
|
||||||
break
|
break
|
||||||
it.increment()
|
it.increment()
|
||||||
@@ -107,28 +107,28 @@ class pyChainSilhouetteGenericIterator(ChainingIterator):
|
|||||||
## case of NonTVertex
|
## case of NonTVertex
|
||||||
natures = [Nature.SILHOUETTE,Nature.BORDER,Nature.CREASE,Nature.SUGGESTIVE_CONTOUR,Nature.VALLEY,Nature.RIDGE]
|
natures = [Nature.SILHOUETTE,Nature.BORDER,Nature.CREASE,Nature.SUGGESTIVE_CONTOUR,Nature.VALLEY,Nature.RIDGE]
|
||||||
for i in range(len(natures)):
|
for i in range(len(natures)):
|
||||||
currentNature = self.getCurrentEdge().getNature()
|
currentNature = self.getCurrentEdge().nature
|
||||||
if(natures[i] & currentNature):
|
if (natures[i] & currentNature) != 0:
|
||||||
count=0
|
count=0
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
visitNext = 0
|
visitNext = 0
|
||||||
oNature = it.getObject().getNature()
|
oNature = it.getObject().nature
|
||||||
ve = it.getObject()
|
ve = it.getObject()
|
||||||
if(ve.getId() == self.getCurrentEdge().getId()):
|
if ve.id == self.getCurrentEdge().id:
|
||||||
it.increment()
|
it.increment()
|
||||||
continue
|
continue
|
||||||
if(oNature & natures[i] != 0):
|
if (oNature & natures[i]) != 0:
|
||||||
if(natures[i] != oNature):
|
if natures[i] != oNature:
|
||||||
for j in range(i):
|
for j in range(i):
|
||||||
if(natures[j] & oNature != 0):
|
if (natures[j] & oNature) != 0:
|
||||||
visitNext = 1
|
visitNext = 1
|
||||||
break
|
break
|
||||||
if(visitNext != 0):
|
if visitNext != 0:
|
||||||
break
|
break
|
||||||
count = count+1
|
count = count+1
|
||||||
winner = ve
|
winner = ve
|
||||||
it.increment()
|
it.increment()
|
||||||
if(count != 1):
|
if count != 1:
|
||||||
winner = None
|
winner = None
|
||||||
break
|
break
|
||||||
return winner
|
return winner
|
||||||
@@ -146,14 +146,14 @@ class pyExternalContourChainingIterator(ChainingIterator):
|
|||||||
self._isInSelection = 1
|
self._isInSelection = 1
|
||||||
|
|
||||||
def checkViewEdge(self, ve, orientation):
|
def checkViewEdge(self, ve, orientation):
|
||||||
if(orientation != 0):
|
if orientation != 0:
|
||||||
vertex = ve.B()
|
vertex = ve.second_svertex()
|
||||||
else:
|
else:
|
||||||
vertex = ve.A()
|
vertex = ve.first_svertex()
|
||||||
it = AdjacencyIterator(vertex,1,1)
|
it = AdjacencyIterator(vertex,1,1)
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
ave = it.getObject()
|
ave = it.getObject()
|
||||||
if(self._isExternalContour(ave)):
|
if self._isExternalContour(ave):
|
||||||
return 1
|
return 1
|
||||||
it.increment()
|
it.increment()
|
||||||
print("pyExternlContourChainingIterator : didn't find next edge")
|
print("pyExternlContourChainingIterator : didn't find next edge")
|
||||||
@@ -161,23 +161,23 @@ class pyExternalContourChainingIterator(ChainingIterator):
|
|||||||
def traverse(self, iter):
|
def traverse(self, iter):
|
||||||
winner = None
|
winner = None
|
||||||
it = AdjacencyIterator(iter)
|
it = AdjacencyIterator(iter)
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
ve = it.getObject()
|
ve = it.getObject()
|
||||||
if(self._isExternalContour(ve)):
|
if self._isExternalContour(ve):
|
||||||
if (ve.getTimeStamp() == GetTimeStampCF()):
|
if ve.time_stamp == GetTimeStampCF():
|
||||||
winner = ve
|
winner = ve
|
||||||
it.increment()
|
it.increment()
|
||||||
|
|
||||||
self._nEdges = self._nEdges+1
|
self._nEdges = self._nEdges+1
|
||||||
if(winner == None):
|
if winner is None:
|
||||||
orient = 1
|
orient = 1
|
||||||
it = AdjacencyIterator(iter)
|
it = AdjacencyIterator(iter)
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
ve = it.getObject()
|
ve = it.getObject()
|
||||||
if(it.isIncoming() != 0):
|
if it.isIncoming() != 0: # FIXME
|
||||||
orient = 0
|
orient = 0
|
||||||
good = self.checkViewEdge(ve,orient)
|
good = self.checkViewEdge(ve,orient)
|
||||||
if(good != 0):
|
if good != 0:
|
||||||
winner = ve
|
winner = ve
|
||||||
it.increment()
|
it.increment()
|
||||||
return winner
|
return winner
|
||||||
@@ -198,10 +198,10 @@ class pySketchyChainSilhouetteIterator(ChainingIterator):
|
|||||||
it = AdjacencyIterator(iter)
|
it = AdjacencyIterator(iter)
|
||||||
tvertex = self.getVertex()
|
tvertex = self.getVertex()
|
||||||
if type(tvertex) is TVertex:
|
if type(tvertex) is TVertex:
|
||||||
mateVE = tvertex.mate(self.getCurrentEdge())
|
mateVE = tvertex.get_mate(self.getCurrentEdge())
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
ve = it.getObject()
|
ve = it.getObject()
|
||||||
if(ve.getId() == mateVE.getId() ):
|
if ve.id == mateVE.id:
|
||||||
winner = ve
|
winner = ve
|
||||||
break
|
break
|
||||||
it.increment()
|
it.increment()
|
||||||
@@ -209,33 +209,33 @@ class pySketchyChainSilhouetteIterator(ChainingIterator):
|
|||||||
## case of NonTVertex
|
## case of NonTVertex
|
||||||
natures = [Nature.SILHOUETTE,Nature.BORDER,Nature.CREASE,Nature.SUGGESTIVE_CONTOUR,Nature.VALLEY,Nature.RIDGE]
|
natures = [Nature.SILHOUETTE,Nature.BORDER,Nature.CREASE,Nature.SUGGESTIVE_CONTOUR,Nature.VALLEY,Nature.RIDGE]
|
||||||
for i in range(len(natures)):
|
for i in range(len(natures)):
|
||||||
currentNature = self.getCurrentEdge().getNature()
|
currentNature = self.getCurrentEdge().nature
|
||||||
if(natures[i] & currentNature):
|
if (natures[i] & currentNature) != 0:
|
||||||
count=0
|
count=0
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
visitNext = 0
|
visitNext = 0
|
||||||
oNature = it.getObject().getNature()
|
oNature = it.getObject().nature
|
||||||
ve = it.getObject()
|
ve = it.getObject()
|
||||||
if(ve.getId() == self.getCurrentEdge().getId()):
|
if ve.id == self.getCurrentEdge().id:
|
||||||
it.increment()
|
it.increment()
|
||||||
continue
|
continue
|
||||||
if(oNature & natures[i] != 0):
|
if (oNature & natures[i]) != 0:
|
||||||
if(natures[i] != oNature):
|
if (natures[i] != oNature) != 0:
|
||||||
for j in range(i):
|
for j in range(i):
|
||||||
if(natures[j] & oNature != 0):
|
if (natures[j] & oNature) != 0:
|
||||||
visitNext = 1
|
visitNext = 1
|
||||||
break
|
break
|
||||||
if(visitNext != 0):
|
if visitNext != 0:
|
||||||
break
|
break
|
||||||
count = count+1
|
count = count+1
|
||||||
winner = ve
|
winner = ve
|
||||||
it.increment()
|
it.increment()
|
||||||
if(count != 1):
|
if count != 1:
|
||||||
winner = None
|
winner = None
|
||||||
break
|
break
|
||||||
if(winner == None):
|
if winner is None:
|
||||||
winner = self.getCurrentEdge()
|
winner = self.getCurrentEdge()
|
||||||
if(winner.getChainingTimeStamp() == self._timeStamp):
|
if winner.chaining_time_stamp == self._timeStamp:
|
||||||
winner = None
|
winner = None
|
||||||
return winner
|
return winner
|
||||||
|
|
||||||
@@ -257,16 +257,16 @@ class pySketchyChainingIterator(ChainingIterator):
|
|||||||
def traverse(self, iter):
|
def traverse(self, iter):
|
||||||
winner = None
|
winner = None
|
||||||
it = AdjacencyIterator(iter)
|
it = AdjacencyIterator(iter)
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
ve = it.getObject()
|
ve = it.getObject()
|
||||||
if(ve.getId() == self.getCurrentEdge().getId()):
|
if ve.id == self.getCurrentEdge().id:
|
||||||
it.increment()
|
it.increment()
|
||||||
continue
|
continue
|
||||||
winner = ve
|
winner = ve
|
||||||
it.increment()
|
it.increment()
|
||||||
if(winner == None):
|
if winner is None:
|
||||||
winner = self.getCurrentEdge()
|
winner = self.getCurrentEdge()
|
||||||
if(winner.getChainingTimeStamp() == self._timeStamp):
|
if winner.chaining_time_stamp == self._timeStamp:
|
||||||
return None
|
return None
|
||||||
return winner
|
return winner
|
||||||
|
|
||||||
@@ -290,16 +290,16 @@ class pyFillOcclusionsRelativeChainingIterator(ChainingIterator):
|
|||||||
def traverse(self, iter):
|
def traverse(self, iter):
|
||||||
winner = None
|
winner = None
|
||||||
winnerOrientation = 0
|
winnerOrientation = 0
|
||||||
print(self.getCurrentEdge().getId().getFirst(), self.getCurrentEdge().getId().getSecond())
|
print(self.getCurrentEdge().id.first, self.getCurrentEdge().id.second)
|
||||||
it = AdjacencyIterator(iter)
|
it = AdjacencyIterator(iter)
|
||||||
tvertex = self.getVertex()
|
tvertex = self.getVertex()
|
||||||
if type(tvertex) is TVertex:
|
if type(tvertex) is TVertex:
|
||||||
mateVE = tvertex.mate(self.getCurrentEdge())
|
mateVE = tvertex.get_mate(self.getCurrentEdge())
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
ve = it.getObject()
|
ve = it.getObject()
|
||||||
if(ve.getId() == mateVE.getId() ):
|
if ve.id == mateVE.id:
|
||||||
winner = ve
|
winner = ve
|
||||||
if(it.isIncoming() == 0):
|
if it.isIncoming() == 0: # FIXME
|
||||||
winnerOrientation = 1
|
winnerOrientation = 1
|
||||||
else:
|
else:
|
||||||
winnerOrientation = 0
|
winnerOrientation = 0
|
||||||
@@ -309,52 +309,52 @@ class pyFillOcclusionsRelativeChainingIterator(ChainingIterator):
|
|||||||
## case of NonTVertex
|
## case of NonTVertex
|
||||||
natures = [Nature.SILHOUETTE,Nature.BORDER,Nature.CREASE,Nature.SUGGESTIVE_CONTOUR,Nature.VALLEY,Nature.RIDGE]
|
natures = [Nature.SILHOUETTE,Nature.BORDER,Nature.CREASE,Nature.SUGGESTIVE_CONTOUR,Nature.VALLEY,Nature.RIDGE]
|
||||||
for nat in natures:
|
for nat in natures:
|
||||||
if(self.getCurrentEdge().getNature() & nat != 0):
|
if (self.getCurrentEdge().nature & nat) != 0:
|
||||||
count=0
|
count=0
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
ve = it.getObject()
|
ve = it.getObject()
|
||||||
if(ve.getNature() & nat != 0):
|
if (ve.nature & nat) != 0:
|
||||||
count = count+1
|
count = count+1
|
||||||
winner = ve
|
winner = ve
|
||||||
if(it.isIncoming() == 0):
|
if it.isIncoming() == 0: # FIXME
|
||||||
winnerOrientation = 1
|
winnerOrientation = 1
|
||||||
else:
|
else:
|
||||||
winnerOrientation = 0
|
winnerOrientation = 0
|
||||||
it.increment()
|
it.increment()
|
||||||
if(count != 1):
|
if count != 1:
|
||||||
winner = None
|
winner = None
|
||||||
break
|
break
|
||||||
if(winner != None):
|
if winner is not None:
|
||||||
# check whether this edge was part of the selection
|
# check whether this edge was part of the selection
|
||||||
if(winner.getTimeStamp() != GetTimeStampCF()):
|
if winner.time_stamp != GetTimeStampCF():
|
||||||
#print("---", winner.getId().getFirst(), winner.getId().getSecond())
|
#print("---", winner.id.first, winner.id.second)
|
||||||
# if not, let's check whether it's short enough with
|
# if not, let's check whether it's short enough with
|
||||||
# respect to the chain made without staying in the selection
|
# respect to the chain made without staying in the selection
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
# Did we compute the prospective chain length already ?
|
# Did we compute the prospective chain length already ?
|
||||||
if(self._length == 0):
|
if self._length == 0:
|
||||||
#if not, let's do it
|
#if not, let's do it
|
||||||
_it = pyChainSilhouetteGenericIterator(0,0)
|
_it = pyChainSilhouetteGenericIterator(0,0)
|
||||||
_it.setBegin(winner)
|
_it.setBegin(winner)
|
||||||
_it.setCurrentEdge(winner)
|
_it.setCurrentEdge(winner)
|
||||||
_it.setOrientation(winnerOrientation)
|
_it.setOrientation(winnerOrientation)
|
||||||
_it.init()
|
_it.init()
|
||||||
while(_it.isEnd() == 0):
|
while not _it.isEnd():
|
||||||
ve = _it.getObject()
|
ve = _it.getObject()
|
||||||
#print("--------", ve.getId().getFirst(), ve.getId().getSecond())
|
#print("--------", ve.id.first, ve.id.second)
|
||||||
self._length = self._length + ve.getLength2D()
|
self._length = self._length + ve.length_2d
|
||||||
_it.increment()
|
_it.increment()
|
||||||
if(_it.isBegin() != 0):
|
if _it.isBegin():
|
||||||
break;
|
break;
|
||||||
_it.setBegin(winner)
|
_it.setBegin(winner)
|
||||||
_it.setCurrentEdge(winner)
|
_it.setCurrentEdge(winner)
|
||||||
_it.setOrientation(winnerOrientation)
|
_it.setOrientation(winnerOrientation)
|
||||||
if(_it.isBegin() == 0):
|
if not _it.isBegin():
|
||||||
_it.decrement()
|
_it.decrement()
|
||||||
while ((_it.isEnd() == 0) and (_it.isBegin() == 0)):
|
while (not _it.isEnd()) and (not _it.isBegin()):
|
||||||
ve = _it.getObject()
|
ve = _it.getObject()
|
||||||
#print("--------", ve.getId().getFirst(), ve.getId().getSecond())
|
#print("--------", ve.id.first, ve.id.second)
|
||||||
self._length = self._length + ve.getLength2D()
|
self._length = self._length + ve.length_2d
|
||||||
_it.decrement()
|
_it.decrement()
|
||||||
|
|
||||||
# let's do the comparison:
|
# let's do the comparison:
|
||||||
@@ -365,12 +365,12 @@ class pyFillOcclusionsRelativeChainingIterator(ChainingIterator):
|
|||||||
_cit.setCurrentEdge(winner)
|
_cit.setCurrentEdge(winner)
|
||||||
_cit.setOrientation(winnerOrientation)
|
_cit.setOrientation(winnerOrientation)
|
||||||
_cit.init()
|
_cit.init()
|
||||||
while((_cit.isEnd() == 0) and (_cit.getObject().getTimeStamp() != GetTimeStampCF())):
|
while _cit.isEnd() == 0 and _cit.getObject().time_stamp != GetTimeStampCF():
|
||||||
ve = _cit.getObject()
|
ve = _cit.getObject()
|
||||||
#print("-------- --------", ve.getId().getFirst(), ve.getId().getSecond())
|
#print("-------- --------", ve.id.first, ve.id.second)
|
||||||
connexl = connexl + ve.getLength2D()
|
connexl = connexl + ve.length_2d
|
||||||
_cit.increment()
|
_cit.increment()
|
||||||
if(connexl > self._percent * self._length):
|
if connexl > self._percent * self._length:
|
||||||
winner = None
|
winner = None
|
||||||
return winner
|
return winner
|
||||||
|
|
||||||
@@ -389,16 +389,16 @@ class pyFillOcclusionsAbsoluteChainingIterator(ChainingIterator):
|
|||||||
def traverse(self, iter):
|
def traverse(self, iter):
|
||||||
winner = None
|
winner = None
|
||||||
winnerOrientation = 0
|
winnerOrientation = 0
|
||||||
#print(self.getCurrentEdge().getId().getFirst(), self.getCurrentEdge().getId().getSecond())
|
#print(self.getCurrentEdge().id.first, self.getCurrentEdge().id.second)
|
||||||
it = AdjacencyIterator(iter)
|
it = AdjacencyIterator(iter)
|
||||||
tvertex = self.getVertex()
|
tvertex = self.getVertex()
|
||||||
if type(tvertex) is TVertex:
|
if type(tvertex) is TVertex:
|
||||||
mateVE = tvertex.mate(self.getCurrentEdge())
|
mateVE = tvertex.get_mate(self.getCurrentEdge())
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
ve = it.getObject()
|
ve = it.getObject()
|
||||||
if(ve.getId() == mateVE.getId() ):
|
if ve.id == mateVE.id:
|
||||||
winner = ve
|
winner = ve
|
||||||
if(it.isIncoming() == 0):
|
if it.isIncoming() == 0: # FIXME
|
||||||
winnerOrientation = 1
|
winnerOrientation = 1
|
||||||
else:
|
else:
|
||||||
winnerOrientation = 0
|
winnerOrientation = 0
|
||||||
@@ -408,25 +408,25 @@ class pyFillOcclusionsAbsoluteChainingIterator(ChainingIterator):
|
|||||||
## case of NonTVertex
|
## case of NonTVertex
|
||||||
natures = [Nature.SILHOUETTE,Nature.BORDER,Nature.CREASE,Nature.SUGGESTIVE_CONTOUR,Nature.VALLEY,Nature.RIDGE]
|
natures = [Nature.SILHOUETTE,Nature.BORDER,Nature.CREASE,Nature.SUGGESTIVE_CONTOUR,Nature.VALLEY,Nature.RIDGE]
|
||||||
for nat in natures:
|
for nat in natures:
|
||||||
if(self.getCurrentEdge().getNature() & nat != 0):
|
if (self.getCurrentEdge().nature & nat) != 0:
|
||||||
count=0
|
count=0
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
ve = it.getObject()
|
ve = it.getObject()
|
||||||
if(ve.getNature() & nat != 0):
|
if (ve.nature & nat) != 0:
|
||||||
count = count+1
|
count = count+1
|
||||||
winner = ve
|
winner = ve
|
||||||
if(it.isIncoming() == 0):
|
if it.isIncoming() == 0: # FIXME
|
||||||
winnerOrientation = 1
|
winnerOrientation = 1
|
||||||
else:
|
else:
|
||||||
winnerOrientation = 0
|
winnerOrientation = 0
|
||||||
it.increment()
|
it.increment()
|
||||||
if(count != 1):
|
if count != 1:
|
||||||
winner = None
|
winner = None
|
||||||
break
|
break
|
||||||
if(winner != None):
|
if winner is not None:
|
||||||
# check whether this edge was part of the selection
|
# check whether this edge was part of the selection
|
||||||
if(winner.getTimeStamp() != GetTimeStampCF()):
|
if winner.time_stamp != GetTimeStampCF():
|
||||||
#print("---", winner.getId().getFirst(), winner.getId().getSecond())
|
#print("---", winner.id.first, winner.id.second)
|
||||||
# nw let's compute the length of this connex non selected part:
|
# nw let's compute the length of this connex non selected part:
|
||||||
connexl = 0
|
connexl = 0
|
||||||
_cit = pyChainSilhouetteGenericIterator(0,0)
|
_cit = pyChainSilhouetteGenericIterator(0,0)
|
||||||
@@ -434,12 +434,12 @@ class pyFillOcclusionsAbsoluteChainingIterator(ChainingIterator):
|
|||||||
_cit.setCurrentEdge(winner)
|
_cit.setCurrentEdge(winner)
|
||||||
_cit.setOrientation(winnerOrientation)
|
_cit.setOrientation(winnerOrientation)
|
||||||
_cit.init()
|
_cit.init()
|
||||||
while((_cit.isEnd() == 0) and (_cit.getObject().getTimeStamp() != GetTimeStampCF())):
|
while _cit.isEnd() == 0 and _cit.getObject().time_stamp != GetTimeStampCF():
|
||||||
ve = _cit.getObject()
|
ve = _cit.getObject()
|
||||||
#print("-------- --------", ve.getId().getFirst(), ve.getId().getSecond())
|
#print("-------- --------", ve.id.first, ve.id.second)
|
||||||
connexl = connexl + ve.getLength2D()
|
connexl = connexl + ve.length_2d
|
||||||
_cit.increment()
|
_cit.increment()
|
||||||
if(connexl > self._length):
|
if connexl > self._length:
|
||||||
winner = None
|
winner = None
|
||||||
return winner
|
return winner
|
||||||
|
|
||||||
@@ -464,16 +464,16 @@ class pyFillOcclusionsAbsoluteAndRelativeChainingIterator(ChainingIterator):
|
|||||||
def traverse(self, iter):
|
def traverse(self, iter):
|
||||||
winner = None
|
winner = None
|
||||||
winnerOrientation = 0
|
winnerOrientation = 0
|
||||||
print(self.getCurrentEdge().getId().getFirst(), self.getCurrentEdge().getId().getSecond())
|
print(self.getCurrentEdge().id.first, self.getCurrentEdge().id.second)
|
||||||
it = AdjacencyIterator(iter)
|
it = AdjacencyIterator(iter)
|
||||||
tvertex = self.getVertex()
|
tvertex = self.getVertex()
|
||||||
if type(tvertex) is TVertex:
|
if type(tvertex) is TVertex:
|
||||||
mateVE = tvertex.mate(self.getCurrentEdge())
|
mateVE = tvertex.get_mate(self.getCurrentEdge())
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
ve = it.getObject()
|
ve = it.getObject()
|
||||||
if(ve.getId() == mateVE.getId() ):
|
if ve.id == mateVE.id:
|
||||||
winner = ve
|
winner = ve
|
||||||
if(it.isIncoming() == 0):
|
if it.isIncoming() == 0: # FIXME
|
||||||
winnerOrientation = 1
|
winnerOrientation = 1
|
||||||
else:
|
else:
|
||||||
winnerOrientation = 0
|
winnerOrientation = 0
|
||||||
@@ -483,52 +483,52 @@ class pyFillOcclusionsAbsoluteAndRelativeChainingIterator(ChainingIterator):
|
|||||||
## case of NonTVertex
|
## case of NonTVertex
|
||||||
natures = [Nature.SILHOUETTE,Nature.BORDER,Nature.CREASE,Nature.SUGGESTIVE_CONTOUR,Nature.VALLEY,Nature.RIDGE]
|
natures = [Nature.SILHOUETTE,Nature.BORDER,Nature.CREASE,Nature.SUGGESTIVE_CONTOUR,Nature.VALLEY,Nature.RIDGE]
|
||||||
for nat in natures:
|
for nat in natures:
|
||||||
if(self.getCurrentEdge().getNature() & nat != 0):
|
if (self.getCurrentEdge().nature & nat) != 0:
|
||||||
count=0
|
count=0
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
ve = it.getObject()
|
ve = it.getObject()
|
||||||
if(ve.getNature() & nat != 0):
|
if (ve.nature & nat) != 0:
|
||||||
count = count+1
|
count = count+1
|
||||||
winner = ve
|
winner = ve
|
||||||
if(it.isIncoming() == 0):
|
if it.isIncoming() == 0: # FIXME
|
||||||
winnerOrientation = 1
|
winnerOrientation = 1
|
||||||
else:
|
else:
|
||||||
winnerOrientation = 0
|
winnerOrientation = 0
|
||||||
it.increment()
|
it.increment()
|
||||||
if(count != 1):
|
if count != 1:
|
||||||
winner = None
|
winner = None
|
||||||
break
|
break
|
||||||
if(winner != None):
|
if winner is not None:
|
||||||
# check whether this edge was part of the selection
|
# check whether this edge was part of the selection
|
||||||
if(winner.getTimeStamp() != GetTimeStampCF()):
|
if winner.time_stamp != GetTimeStampCF():
|
||||||
#print("---", winner.getId().getFirst(), winner.getId().getSecond())
|
#print("---", winner.id.first, winner.id.second)
|
||||||
# if not, let's check whether it's short enough with
|
# if not, let's check whether it's short enough with
|
||||||
# respect to the chain made without staying in the selection
|
# respect to the chain made without staying in the selection
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
# Did we compute the prospective chain length already ?
|
# Did we compute the prospective chain length already ?
|
||||||
if(self._length == 0):
|
if self._length == 0:
|
||||||
#if not, let's do it
|
#if not, let's do it
|
||||||
_it = pyChainSilhouetteGenericIterator(0,0)
|
_it = pyChainSilhouetteGenericIterator(0,0)
|
||||||
_it.setBegin(winner)
|
_it.setBegin(winner)
|
||||||
_it.setCurrentEdge(winner)
|
_it.setCurrentEdge(winner)
|
||||||
_it.setOrientation(winnerOrientation)
|
_it.setOrientation(winnerOrientation)
|
||||||
_it.init()
|
_it.init()
|
||||||
while(_it.isEnd() == 0):
|
while not _it.isEnd():
|
||||||
ve = _it.getObject()
|
ve = _it.getObject()
|
||||||
#print("--------", ve.getId().getFirst(), ve.getId().getSecond())
|
#print("--------", ve.id.first, ve.id.second)
|
||||||
self._length = self._length + ve.getLength2D()
|
self._length = self._length + ve.length_2d
|
||||||
_it.increment()
|
_it.increment()
|
||||||
if(_it.isBegin() != 0):
|
if _it.isBegin():
|
||||||
break;
|
break;
|
||||||
_it.setBegin(winner)
|
_it.setBegin(winner)
|
||||||
_it.setCurrentEdge(winner)
|
_it.setCurrentEdge(winner)
|
||||||
_it.setOrientation(winnerOrientation)
|
_it.setOrientation(winnerOrientation)
|
||||||
if(_it.isBegin() == 0):
|
if not _it.isBegin():
|
||||||
_it.decrement()
|
_it.decrement()
|
||||||
while ((_it.isEnd() == 0) and (_it.isBegin() == 0)):
|
while (not _it.isEnd()) and (not _it.isBegin()):
|
||||||
ve = _it.getObject()
|
ve = _it.getObject()
|
||||||
#print("--------", ve.getId().getFirst(), ve.getId().getSecond())
|
#print("--------", ve.id.first, ve.id.second)
|
||||||
self._length = self._length + ve.getLength2D()
|
self._length = self._length + ve.length_2d
|
||||||
_it.decrement()
|
_it.decrement()
|
||||||
|
|
||||||
# let's do the comparison:
|
# let's do the comparison:
|
||||||
@@ -539,12 +539,12 @@ class pyFillOcclusionsAbsoluteAndRelativeChainingIterator(ChainingIterator):
|
|||||||
_cit.setCurrentEdge(winner)
|
_cit.setCurrentEdge(winner)
|
||||||
_cit.setOrientation(winnerOrientation)
|
_cit.setOrientation(winnerOrientation)
|
||||||
_cit.init()
|
_cit.init()
|
||||||
while((_cit.isEnd() == 0) and (_cit.getObject().getTimeStamp() != GetTimeStampCF())):
|
while _cit.isEnd() == 0 and _cit.getObject().time_stamp != GetTimeStampCF():
|
||||||
ve = _cit.getObject()
|
ve = _cit.getObject()
|
||||||
#print("-------- --------", ve.getId().getFirst(), ve.getId().getSecond())
|
#print("-------- --------", ve.id.first, ve.id.second)
|
||||||
connexl = connexl + ve.getLength2D()
|
connexl = connexl + ve.length_2d
|
||||||
_cit.increment()
|
_cit.increment()
|
||||||
if((connexl > self._percent * self._length) or (connexl > self._absLength)):
|
if (connexl > self._percent * self._length) or (connexl > self._absLength):
|
||||||
winner = None
|
winner = None
|
||||||
return winner
|
return winner
|
||||||
|
|
||||||
@@ -569,16 +569,16 @@ class pyFillQi0AbsoluteAndRelativeChainingIterator(ChainingIterator):
|
|||||||
def traverse(self, iter):
|
def traverse(self, iter):
|
||||||
winner = None
|
winner = None
|
||||||
winnerOrientation = 0
|
winnerOrientation = 0
|
||||||
print(self.getCurrentEdge().getId().getFirst(), self.getCurrentEdge().getId().getSecond())
|
print(self.getCurrentEdge().id.first, self.getCurrentEdge().id.second)
|
||||||
it = AdjacencyIterator(iter)
|
it = AdjacencyIterator(iter)
|
||||||
tvertex = self.getVertex()
|
tvertex = self.getVertex()
|
||||||
if type(tvertex) is TVertex:
|
if type(tvertex) is TVertex:
|
||||||
mateVE = tvertex.mate(self.getCurrentEdge())
|
mateVE = tvertex.get_mate(self.getCurrentEdge())
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
ve = it.getObject()
|
ve = it.getObject()
|
||||||
if(ve.getId() == mateVE.getId() ):
|
if ve.id == mateVE.id:
|
||||||
winner = ve
|
winner = ve
|
||||||
if(it.isIncoming() == 0):
|
if it.isIncoming() == 0: # FIXME
|
||||||
winnerOrientation = 1
|
winnerOrientation = 1
|
||||||
else:
|
else:
|
||||||
winnerOrientation = 0
|
winnerOrientation = 0
|
||||||
@@ -588,52 +588,52 @@ class pyFillQi0AbsoluteAndRelativeChainingIterator(ChainingIterator):
|
|||||||
## case of NonTVertex
|
## case of NonTVertex
|
||||||
natures = [Nature.SILHOUETTE,Nature.BORDER,Nature.CREASE,Nature.SUGGESTIVE_CONTOUR,Nature.VALLEY,Nature.RIDGE]
|
natures = [Nature.SILHOUETTE,Nature.BORDER,Nature.CREASE,Nature.SUGGESTIVE_CONTOUR,Nature.VALLEY,Nature.RIDGE]
|
||||||
for nat in natures:
|
for nat in natures:
|
||||||
if(self.getCurrentEdge().getNature() & nat != 0):
|
if (self.getCurrentEdge().nature & nat) != 0:
|
||||||
count=0
|
count=0
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
ve = it.getObject()
|
ve = it.getObject()
|
||||||
if(ve.getNature() & nat != 0):
|
if (ve.nature & nat) != 0:
|
||||||
count = count+1
|
count = count+1
|
||||||
winner = ve
|
winner = ve
|
||||||
if(it.isIncoming() == 0):
|
if it.isIncoming() == 0: # FIXME
|
||||||
winnerOrientation = 1
|
winnerOrientation = 1
|
||||||
else:
|
else:
|
||||||
winnerOrientation = 0
|
winnerOrientation = 0
|
||||||
it.increment()
|
it.increment()
|
||||||
if(count != 1):
|
if count != 1:
|
||||||
winner = None
|
winner = None
|
||||||
break
|
break
|
||||||
if(winner != None):
|
if winner is not None:
|
||||||
# check whether this edge was part of the selection
|
# check whether this edge was part of the selection
|
||||||
if(winner.qi() != 0):
|
if winner.qi != 0:
|
||||||
#print("---", winner.getId().getFirst(), winner.getId().getSecond())
|
#print("---", winner.id.first, winner.id.second)
|
||||||
# if not, let's check whether it's short enough with
|
# if not, let's check whether it's short enough with
|
||||||
# respect to the chain made without staying in the selection
|
# respect to the chain made without staying in the selection
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
# Did we compute the prospective chain length already ?
|
# Did we compute the prospective chain length already ?
|
||||||
if(self._length == 0):
|
if self._length == 0:
|
||||||
#if not, let's do it
|
#if not, let's do it
|
||||||
_it = pyChainSilhouetteGenericIterator(0,0)
|
_it = pyChainSilhouetteGenericIterator(0,0)
|
||||||
_it.setBegin(winner)
|
_it.setBegin(winner)
|
||||||
_it.setCurrentEdge(winner)
|
_it.setCurrentEdge(winner)
|
||||||
_it.setOrientation(winnerOrientation)
|
_it.setOrientation(winnerOrientation)
|
||||||
_it.init()
|
_it.init()
|
||||||
while(_it.isEnd() == 0):
|
while not _it.isEnd():
|
||||||
ve = _it.getObject()
|
ve = _it.getObject()
|
||||||
#print("--------", ve.getId().getFirst(), ve.getId().getSecond())
|
#print("--------", ve.id.first, ve.id.second)
|
||||||
self._length = self._length + ve.getLength2D()
|
self._length = self._length + ve.length_2d
|
||||||
_it.increment()
|
_it.increment()
|
||||||
if(_it.isBegin() != 0):
|
if _it.isBegin():
|
||||||
break;
|
break;
|
||||||
_it.setBegin(winner)
|
_it.setBegin(winner)
|
||||||
_it.setCurrentEdge(winner)
|
_it.setCurrentEdge(winner)
|
||||||
_it.setOrientation(winnerOrientation)
|
_it.setOrientation(winnerOrientation)
|
||||||
if(_it.isBegin() == 0):
|
if not _it.isBegin():
|
||||||
_it.decrement()
|
_it.decrement()
|
||||||
while ((_it.isEnd() == 0) and (_it.isBegin() == 0)):
|
while (not _it.isEnd()) and (not _it.isBegin()):
|
||||||
ve = _it.getObject()
|
ve = _it.getObject()
|
||||||
#print("--------", ve.getId().getFirst(), ve.getId().getSecond())
|
#print("--------", ve.id.first, ve.id.second)
|
||||||
self._length = self._length + ve.getLength2D()
|
self._length = self._length + ve.length_2d
|
||||||
_it.decrement()
|
_it.decrement()
|
||||||
|
|
||||||
# let's do the comparison:
|
# let's do the comparison:
|
||||||
@@ -644,12 +644,12 @@ class pyFillQi0AbsoluteAndRelativeChainingIterator(ChainingIterator):
|
|||||||
_cit.setCurrentEdge(winner)
|
_cit.setCurrentEdge(winner)
|
||||||
_cit.setOrientation(winnerOrientation)
|
_cit.setOrientation(winnerOrientation)
|
||||||
_cit.init()
|
_cit.init()
|
||||||
while((_cit.isEnd() == 0) and (_cit.getObject().qi() != 0)):
|
while not _cit.isEnd() and _cit.getObject().qi != 0:
|
||||||
ve = _cit.getObject()
|
ve = _cit.getObject()
|
||||||
#print("-------- --------", ve.getId().getFirst(), ve.getId().getSecond())
|
#print("-------- --------", ve.id.first, ve.id.second)
|
||||||
connexl = connexl + ve.getLength2D()
|
connexl = connexl + ve.length_2d
|
||||||
_cit.increment()
|
_cit.increment()
|
||||||
if((connexl > self._percent * self._length) or (connexl > self._absLength)):
|
if (connexl > self._percent * self._length) or (connexl > self._absLength):
|
||||||
winner = None
|
winner = None
|
||||||
return winner
|
return winner
|
||||||
|
|
||||||
@@ -671,35 +671,35 @@ class pyNoIdChainSilhouetteIterator(ChainingIterator):
|
|||||||
it = AdjacencyIterator(iter)
|
it = AdjacencyIterator(iter)
|
||||||
tvertex = self.getVertex()
|
tvertex = self.getVertex()
|
||||||
if type(tvertex) is TVertex:
|
if type(tvertex) is TVertex:
|
||||||
mateVE = tvertex.mate(self.getCurrentEdge())
|
mateVE = tvertex.get_mate(self.getCurrentEdge())
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
ve = it.getObject()
|
ve = it.getObject()
|
||||||
feB = self.getCurrentEdge().fedgeB()
|
feB = self.getCurrentEdge().last_fedge
|
||||||
feA = ve.fedgeA()
|
feA = ve.first_fedge
|
||||||
vB = feB.vertexB()
|
vB = feB.second_svertex
|
||||||
vA = feA.vertexA()
|
vA = feA.first_svertex
|
||||||
if vA.getId().getFirst() == vB.getId().getFirst():
|
if vA.id.first == vB.id.first:
|
||||||
winner = ve
|
winner = ve
|
||||||
break
|
break
|
||||||
feA = self.getCurrentEdge().fedgeA()
|
feA = self.getCurrentEdge().first_fedge
|
||||||
feB = ve.fedgeB()
|
feB = ve.last_fedge
|
||||||
vB = feB.vertexB()
|
vB = feB.second_svertex
|
||||||
vA = feA.vertexA()
|
vA = feA.first_svertex
|
||||||
if vA.getId().getFirst() == vB.getId().getFirst():
|
if vA.id.first == vB.id.first:
|
||||||
winner = ve
|
winner = ve
|
||||||
break
|
break
|
||||||
feA = self.getCurrentEdge().fedgeB()
|
feA = self.getCurrentEdge().last_fedge
|
||||||
feB = ve.fedgeB()
|
feB = ve.last_fedge
|
||||||
vB = feB.vertexB()
|
vB = feB.second_svertex
|
||||||
vA = feA.vertexB()
|
vA = feA.second_svertex
|
||||||
if vA.getId().getFirst() == vB.getId().getFirst():
|
if vA.id.first == vB.id.first:
|
||||||
winner = ve
|
winner = ve
|
||||||
break
|
break
|
||||||
feA = self.getCurrentEdge().fedgeA()
|
feA = self.getCurrentEdge().first_fedge
|
||||||
feB = ve.fedgeA()
|
feB = ve.first_fedge
|
||||||
vB = feB.vertexA()
|
vB = feB.first_svertex
|
||||||
vA = feA.vertexA()
|
vA = feA.first_svertex
|
||||||
if vA.getId().getFirst() == vB.getId().getFirst():
|
if vA.id.first == vB.id.first:
|
||||||
winner = ve
|
winner = ve
|
||||||
break
|
break
|
||||||
it.increment()
|
it.increment()
|
||||||
@@ -707,24 +707,24 @@ class pyNoIdChainSilhouetteIterator(ChainingIterator):
|
|||||||
## case of NonTVertex
|
## case of NonTVertex
|
||||||
natures = [Nature.SILHOUETTE,Nature.BORDER,Nature.CREASE,Nature.SUGGESTIVE_CONTOUR,Nature.VALLEY,Nature.RIDGE]
|
natures = [Nature.SILHOUETTE,Nature.BORDER,Nature.CREASE,Nature.SUGGESTIVE_CONTOUR,Nature.VALLEY,Nature.RIDGE]
|
||||||
for i in range(len(natures)):
|
for i in range(len(natures)):
|
||||||
currentNature = self.getCurrentEdge().getNature()
|
currentNature = self.getCurrentEdge().nature
|
||||||
if(natures[i] & currentNature):
|
if (natures[i] & currentNature) != 0:
|
||||||
count=0
|
count=0
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
visitNext = 0
|
visitNext = 0
|
||||||
oNature = it.getObject().getNature()
|
oNature = it.getObject().nature
|
||||||
if(oNature & natures[i] != 0):
|
if (oNature & natures[i]) != 0:
|
||||||
if(natures[i] != oNature):
|
if natures[i] != oNature:
|
||||||
for j in range(i):
|
for j in range(i):
|
||||||
if(natures[j] & oNature != 0):
|
if (natures[j] & oNature) != 0:
|
||||||
visitNext = 1
|
visitNext = 1
|
||||||
break
|
break
|
||||||
if(visitNext != 0):
|
if visitNext != 0:
|
||||||
break
|
break
|
||||||
count = count+1
|
count = count+1
|
||||||
winner = it.getObject()
|
winner = it.getObject()
|
||||||
it.increment()
|
it.increment()
|
||||||
if(count != 1):
|
if count != 1:
|
||||||
winner = None
|
winner = None
|
||||||
break
|
break
|
||||||
return winner
|
return winner
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ class CurveMaterialF0D(UnaryFunction0DMaterial):
|
|||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
cp = inter.getObject()
|
cp = inter.getObject()
|
||||||
assert(isinstance(cp, CurvePoint))
|
assert(isinstance(cp, CurvePoint))
|
||||||
fe = cp.A().getFEdge(cp.B())
|
fe = cp.first_svertex.get_fedge(cp.second_svertex)
|
||||||
assert(fe is not None)
|
assert(fe is not None)
|
||||||
return fe.material() if fe.isSmooth() else fe.bMaterial()
|
return fe.material if fe.is_smooth else fe.material_left
|
||||||
|
|
||||||
class pyInverseCurvature2DAngleF0D(UnaryFunction0DDouble):
|
class pyInverseCurvature2DAngleF0D(UnaryFunction0DDouble):
|
||||||
def getName(self):
|
def getName(self):
|
||||||
@@ -26,13 +26,9 @@ class pyCurvilinearLengthF0D(UnaryFunction0DDouble):
|
|||||||
return "CurvilinearLengthF0D"
|
return "CurvilinearLengthF0D"
|
||||||
|
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
i0d = inter.getObject()
|
cp = inter.getObject()
|
||||||
s = i0d.getExactTypeName()
|
assert(isinstance(cp, CurvePoint))
|
||||||
if (string.find(s, "CurvePoint") == -1):
|
return cp.t2d
|
||||||
print("CurvilinearLengthF0D: not implemented yet for", s)
|
|
||||||
return -1
|
|
||||||
cp = castToCurvePoint(i0d)
|
|
||||||
return cp.t2d()
|
|
||||||
|
|
||||||
## estimate anisotropy of density
|
## estimate anisotropy of density
|
||||||
class pyDensityAnisotropyF0D(UnaryFunction0DDouble):
|
class pyDensityAnisotropyF0D(UnaryFunction0DDouble):
|
||||||
@@ -51,13 +47,13 @@ class pyDensityAnisotropyF0D(UnaryFunction0DDouble):
|
|||||||
c_1 = self.d1Density(inter)
|
c_1 = self.d1Density(inter)
|
||||||
c_2 = self.d2Density(inter)
|
c_2 = self.d2Density(inter)
|
||||||
c_3 = self.d3Density(inter)
|
c_3 = self.d3Density(inter)
|
||||||
cMax = max( max(c_0,c_1), max(c_2,c_3))
|
cMax = max(max(c_0,c_1), max(c_2,c_3))
|
||||||
cMin = min( min(c_0,c_1), min(c_2,c_3))
|
cMin = min(min(c_0,c_1), min(c_2,c_3))
|
||||||
if ( c_iso == 0 ):
|
if c_iso == 0:
|
||||||
v = 0
|
v = 0
|
||||||
else:
|
else:
|
||||||
v = (cMax-cMin)/c_iso
|
v = (cMax-cMin)/c_iso
|
||||||
return (v)
|
return v
|
||||||
|
|
||||||
## Returns the gradient vector for a pixel
|
## Returns the gradient vector for a pixel
|
||||||
## l
|
## l
|
||||||
@@ -70,9 +66,9 @@ class pyViewMapGradientVectorF0D(UnaryFunction0DVec2f):
|
|||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyViewMapGradientVectorF0D"
|
return "pyViewMapGradientVectorF0D"
|
||||||
def __call__(self, iter):
|
def __call__(self, iter):
|
||||||
p = iter.getObject().getPoint2D()
|
p = iter.getObject().point_2d
|
||||||
gx = ReadCompleteViewMapPixelCF(self._l, int(p.x()+self._step), int(p.y()))- ReadCompleteViewMapPixelCF(self._l, int(p.x()), int(p.y()))
|
gx = ReadCompleteViewMapPixelCF(self._l, int(p.x+self._step), int(p.y))- ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y))
|
||||||
gy = ReadCompleteViewMapPixelCF(self._l, int(p.x()), int(p.y()+self._step))- ReadCompleteViewMapPixelCF(self._l, int(p.x()), int(p.y()))
|
gy = ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y+self._step))- ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y))
|
||||||
return Vector([gx, gy])
|
return Vector([gx, gy])
|
||||||
|
|
||||||
class pyViewMapGradientNormF0D(UnaryFunction0DDouble):
|
class pyViewMapGradientNormF0D(UnaryFunction0DDouble):
|
||||||
@@ -83,9 +79,9 @@ class pyViewMapGradientNormF0D(UnaryFunction0DDouble):
|
|||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyViewMapGradientNormF0D"
|
return "pyViewMapGradientNormF0D"
|
||||||
def __call__(self, iter):
|
def __call__(self, iter):
|
||||||
p = iter.getObject().getPoint2D()
|
p = iter.getObject().point_2d
|
||||||
gx = ReadCompleteViewMapPixelCF(self._l, int(p.x()+self._step), int(p.y()))- ReadCompleteViewMapPixelCF(self._l, int(p.x()), int(p.y()))
|
gx = ReadCompleteViewMapPixelCF(self._l, int(p.x+self._step), int(p.y))- ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y))
|
||||||
gy = ReadCompleteViewMapPixelCF(self._l, int(p.x()), int(p.y()+self._step))- ReadCompleteViewMapPixelCF(self._l, int(p.x()), int(p.y()))
|
gy = ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y+self._step))- ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y))
|
||||||
grad = Vector([gx, gy])
|
grad = Vector([gx, gy])
|
||||||
return grad.length
|
return grad.length
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ from random import *
|
|||||||
class pyZBP1D(BinaryPredicate1D):
|
class pyZBP1D(BinaryPredicate1D):
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyZBP1D"
|
return "pyZBP1D"
|
||||||
|
|
||||||
def __call__(self, i1, i2):
|
def __call__(self, i1, i2):
|
||||||
func = GetZF1D()
|
func = GetZF1D()
|
||||||
return (func(i1) > func(i2))
|
return (func(i1) > func(i2))
|
||||||
@@ -14,38 +13,33 @@ class pyZDiscontinuityBP1D(BinaryPredicate1D):
|
|||||||
def __init__(self, iType = IntegrationType.MEAN):
|
def __init__(self, iType = IntegrationType.MEAN):
|
||||||
BinaryPredicate1D.__init__(self)
|
BinaryPredicate1D.__init__(self)
|
||||||
self._GetZDiscontinuity = ZDiscontinuityF1D(iType)
|
self._GetZDiscontinuity = ZDiscontinuityF1D(iType)
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyZDiscontinuityBP1D"
|
return "pyZDiscontinuityBP1D"
|
||||||
|
|
||||||
def __call__(self, i1, i2):
|
def __call__(self, i1, i2):
|
||||||
return (self._GetZDiscontinuity(i1) > self._GetZDiscontinuity(i2))
|
return (self._GetZDiscontinuity(i1) > self._GetZDiscontinuity(i2))
|
||||||
|
|
||||||
class pyLengthBP1D(BinaryPredicate1D):
|
class pyLengthBP1D(BinaryPredicate1D):
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "LengthBP1D"
|
return "LengthBP1D"
|
||||||
|
|
||||||
def __call__(self, i1, i2):
|
def __call__(self, i1, i2):
|
||||||
return (i1.getLength2D() > i2.getLength2D())
|
return (i1.length_2d > i2.length_2d)
|
||||||
|
|
||||||
class pySilhouetteFirstBP1D(BinaryPredicate1D):
|
class pySilhouetteFirstBP1D(BinaryPredicate1D):
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "SilhouetteFirstBP1D"
|
return "SilhouetteFirstBP1D"
|
||||||
|
|
||||||
def __call__(self, inter1, inter2):
|
def __call__(self, inter1, inter2):
|
||||||
bpred = SameShapeIdBP1D()
|
bpred = SameShapeIdBP1D()
|
||||||
if (bpred(inter1, inter2) != 1):
|
if (bpred(inter1, inter2) != 1):
|
||||||
return 0
|
return 0
|
||||||
if (inter1.getNature() & Nature.SILHOUETTE):
|
if (inter1.nature & Nature.SILHOUETTE):
|
||||||
return (inter2.getNature() & Nature.SILHOUETTE)
|
return (inter2.nature & Nature.SILHOUETTE) != 0
|
||||||
return (inter1.getNature() == inter2.getNature())
|
return (inter1.nature == inter2.nature)
|
||||||
|
|
||||||
class pyNatureBP1D(BinaryPredicate1D):
|
class pyNatureBP1D(BinaryPredicate1D):
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "NatureBP1D"
|
return "NatureBP1D"
|
||||||
|
|
||||||
def __call__(self, inter1, inter2):
|
def __call__(self, inter1, inter2):
|
||||||
return (inter1.getNature() & inter2.getNature())
|
return (inter1.nature & inter2.nature)
|
||||||
|
|
||||||
class pyViewMapGradientNormBP1D(BinaryPredicate1D):
|
class pyViewMapGradientNormBP1D(BinaryPredicate1D):
|
||||||
def __init__(self,l, sampling=2.0):
|
def __init__(self,l, sampling=2.0):
|
||||||
@@ -63,7 +57,6 @@ class pyShuffleBP1D(BinaryPredicate1D):
|
|||||||
seed(1)
|
seed(1)
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyNearAndContourFirstBP1D"
|
return "pyNearAndContourFirstBP1D"
|
||||||
|
|
||||||
def __call__(self, inter1, inter2):
|
def __call__(self, inter1, inter2):
|
||||||
r1 = uniform(0,1)
|
r1 = uniform(0,1)
|
||||||
r2 = uniform(0,1)
|
r2 = uniform(0,1)
|
||||||
|
|||||||
@@ -5,43 +5,34 @@ class pyHigherCurvature2DAngleUP0D(UnaryPredicate0D):
|
|||||||
def __init__(self,a):
|
def __init__(self,a):
|
||||||
UnaryPredicate0D.__init__(self)
|
UnaryPredicate0D.__init__(self)
|
||||||
self._a = a
|
self._a = a
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "HigherCurvature2DAngleUP0D"
|
return "HigherCurvature2DAngleUP0D"
|
||||||
|
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
func = Curvature2DAngleF0D()
|
func = Curvature2DAngleF0D()
|
||||||
a = func(inter)
|
a = func(inter)
|
||||||
return ( a > self._a)
|
return (a > self._a)
|
||||||
|
|
||||||
class pyUEqualsUP0D(UnaryPredicate0D):
|
class pyUEqualsUP0D(UnaryPredicate0D):
|
||||||
def __init__(self,u, w):
|
def __init__(self,u, w):
|
||||||
UnaryPredicate0D.__init__(self)
|
UnaryPredicate0D.__init__(self)
|
||||||
self._u = u
|
self._u = u
|
||||||
self._w = w
|
self._w = w
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "UEqualsUP0D"
|
return "UEqualsUP0D"
|
||||||
|
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
func = pyCurvilinearLengthF0D()
|
func = pyCurvilinearLengthF0D()
|
||||||
u = func(inter)
|
u = func(inter)
|
||||||
return ( ( u > (self._u-self._w) ) and ( u < (self._u+self._w) ) )
|
return (u > (self._u-self._w)) and (u < (self._u+self._w))
|
||||||
|
|
||||||
class pyVertexNatureUP0D(UnaryPredicate0D):
|
class pyVertexNatureUP0D(UnaryPredicate0D):
|
||||||
def __init__(self,nature):
|
def __init__(self,nature):
|
||||||
UnaryPredicate0D.__init__(self)
|
UnaryPredicate0D.__init__(self)
|
||||||
self._nature = nature
|
self._nature = nature
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyVertexNatureUP0D"
|
return "pyVertexNatureUP0D"
|
||||||
|
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
v = inter.getObject()
|
v = inter.getObject()
|
||||||
nat = v.getNature()
|
return (v.nature & self._nature) != 0
|
||||||
if(nat & self._nature):
|
|
||||||
return 1;
|
|
||||||
return 0
|
|
||||||
|
|
||||||
## check whether an Interface0DIterator
|
## check whether an Interface0DIterator
|
||||||
## is a TVertex and is the one that is
|
## is a TVertex and is the one that is
|
||||||
@@ -54,13 +45,13 @@ class pyBackTVertexUP0D(UnaryPredicate0D):
|
|||||||
return "pyBackTVertexUP0D"
|
return "pyBackTVertexUP0D"
|
||||||
def __call__(self, iter):
|
def __call__(self, iter):
|
||||||
v = iter.getObject()
|
v = iter.getObject()
|
||||||
nat = v.getNature()
|
nat = v.nature
|
||||||
if(nat & Nature.T_VERTEX == 0):
|
if (nat & Nature.T_VERTEX) == 0:
|
||||||
return 0
|
return 0
|
||||||
next = iter
|
next = iter
|
||||||
if(next.isEnd()):
|
if next.isEnd():
|
||||||
return 0
|
return 0
|
||||||
if(self._getQI(next) != 0):
|
if self._getQI(next) != 0:
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -70,13 +61,11 @@ class pyParameterUP0DGoodOne(UnaryPredicate0D):
|
|||||||
self._m = pmin
|
self._m = pmin
|
||||||
self._M = pmax
|
self._M = pmax
|
||||||
#self.getCurvilinearAbscissa = GetCurvilinearAbscissaF0D()
|
#self.getCurvilinearAbscissa = GetCurvilinearAbscissaF0D()
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyCurvilinearAbscissaHigherThanUP0D"
|
return "pyCurvilinearAbscissaHigherThanUP0D"
|
||||||
|
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
#s = self.getCurvilinearAbscissa(inter)
|
#s = self.getCurvilinearAbscissa(inter)
|
||||||
u = inter.u()
|
u = inter.u() # FIXME
|
||||||
#print(u)
|
#print(u)
|
||||||
return ((u>=self._m) and (u<=self._M))
|
return ((u>=self._m) and (u<=self._M))
|
||||||
|
|
||||||
@@ -86,18 +75,14 @@ class pyParameterUP0D(UnaryPredicate0D):
|
|||||||
self._m = pmin
|
self._m = pmin
|
||||||
self._M = pmax
|
self._M = pmax
|
||||||
#self.getCurvilinearAbscissa = GetCurvilinearAbscissaF0D()
|
#self.getCurvilinearAbscissa = GetCurvilinearAbscissaF0D()
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyCurvilinearAbscissaHigherThanUP0D"
|
return "pyCurvilinearAbscissaHigherThanUP0D"
|
||||||
|
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
func = Curvature2DAngleF0D()
|
func = Curvature2DAngleF0D()
|
||||||
c = func(inter)
|
c = func(inter)
|
||||||
b1 = (c>0.1)
|
b1 = (c>0.1)
|
||||||
#s = self.getCurvilinearAbscissa(inter)
|
#s = self.getCurvilinearAbscissa(inter)
|
||||||
u = inter.u()
|
u = inter.u() # FIXME
|
||||||
#print(u)
|
#print(u)
|
||||||
b = ((u>=self._m) and (u<=self._M))
|
b = ((u>=self._m) and (u<=self._M))
|
||||||
return b and b1
|
return b and b1
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,22 +17,18 @@ class pyHigherLengthUP1D(UnaryPredicate1D):
|
|||||||
def __init__(self,l):
|
def __init__(self,l):
|
||||||
UnaryPredicate1D.__init__(self)
|
UnaryPredicate1D.__init__(self)
|
||||||
self._l = l
|
self._l = l
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "HigherLengthUP1D"
|
return "HigherLengthUP1D"
|
||||||
|
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
return (inter.getLength2D() > self._l)
|
return (inter.length_2d > self._l)
|
||||||
|
|
||||||
class pyNatureUP1D(UnaryPredicate1D):
|
class pyNatureUP1D(UnaryPredicate1D):
|
||||||
def __init__(self,nature):
|
def __init__(self,nature):
|
||||||
UnaryPredicate1D.__init__(self)
|
UnaryPredicate1D.__init__(self)
|
||||||
self._nature = nature
|
self._nature = nature
|
||||||
self._getNature = CurveNatureF1D()
|
self._getNature = CurveNatureF1D()
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyNatureUP1D"
|
return "pyNatureUP1D"
|
||||||
|
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
if(self._getNature(inter) & self._nature):
|
if(self._getNature(inter) & self._nature):
|
||||||
return 1
|
return 1
|
||||||
@@ -43,18 +39,16 @@ class pyHigherNumberOfTurnsUP1D(UnaryPredicate1D):
|
|||||||
UnaryPredicate1D.__init__(self)
|
UnaryPredicate1D.__init__(self)
|
||||||
self._n = n
|
self._n = n
|
||||||
self._a = a
|
self._a = a
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "HigherNumberOfTurnsUP1D"
|
return "HigherNumberOfTurnsUP1D"
|
||||||
|
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
count = 0
|
count = 0
|
||||||
func = Curvature2DAngleF0D()
|
func = Curvature2DAngleF0D()
|
||||||
it = inter.verticesBegin()
|
it = inter.vertices_begin()
|
||||||
while(it.isEnd() == 0):
|
while not it.isEnd():
|
||||||
if(func(it) > self._a):
|
if func(it) > self._a:
|
||||||
count = count+1
|
count = count+1
|
||||||
if(count > self._n):
|
if count > self._n:
|
||||||
return 1
|
return 1
|
||||||
it.increment()
|
it.increment()
|
||||||
return 0
|
return 0
|
||||||
@@ -66,12 +60,10 @@ class pyDensityUP1D(UnaryPredicate1D):
|
|||||||
self._threshold = threshold
|
self._threshold = threshold
|
||||||
self._integration = integration
|
self._integration = integration
|
||||||
self._func = DensityF1D(self._wsize, self._integration, sampling)
|
self._func = DensityF1D(self._wsize, self._integration, sampling)
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyDensityUP1D"
|
return "pyDensityUP1D"
|
||||||
|
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
if(self._func(inter) < self._threshold):
|
if self._func(inter) < self._threshold:
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -81,15 +73,13 @@ class pyLowSteerableViewMapDensityUP1D(UnaryPredicate1D):
|
|||||||
self._threshold = threshold
|
self._threshold = threshold
|
||||||
self._level = level
|
self._level = level
|
||||||
self._integration = integration
|
self._integration = integration
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyLowSteerableViewMapDensityUP1D"
|
return "pyLowSteerableViewMapDensityUP1D"
|
||||||
|
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
func = GetSteerableViewMapDensityF1D(self._level, self._integration)
|
func = GetSteerableViewMapDensityF1D(self._level, self._integration)
|
||||||
v = func(inter)
|
v = func(inter)
|
||||||
print(v)
|
print(v)
|
||||||
if(v < self._threshold):
|
if v < self._threshold:
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -100,15 +90,13 @@ class pyLowDirectionalViewMapDensityUP1D(UnaryPredicate1D):
|
|||||||
self._orientation = orientation
|
self._orientation = orientation
|
||||||
self._level = level
|
self._level = level
|
||||||
self._integration = integration
|
self._integration = integration
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyLowDirectionalViewMapDensityUP1D"
|
return "pyLowDirectionalViewMapDensityUP1D"
|
||||||
|
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
func = GetDirectionalViewMapDensityF1D(self._orientation, self._level, self._integration)
|
func = GetDirectionalViewMapDensityF1D(self._orientation, self._level, self._integration)
|
||||||
v = func(inter)
|
v = func(inter)
|
||||||
#print(v)
|
#print(v)
|
||||||
if(v < self._threshold):
|
if v < self._threshold:
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -121,11 +109,9 @@ class pyHighSteerableViewMapDensityUP1D(UnaryPredicate1D):
|
|||||||
self._func = GetSteerableViewMapDensityF1D(self._level, self._integration)
|
self._func = GetSteerableViewMapDensityF1D(self._level, self._integration)
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyHighSteerableViewMapDensityUP1D"
|
return "pyHighSteerableViewMapDensityUP1D"
|
||||||
|
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
|
|
||||||
v = self._func(inter)
|
v = self._func(inter)
|
||||||
if(v > self._threshold):
|
if v > self._threshold:
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -139,11 +125,10 @@ class pyHighDirectionalViewMapDensityUP1D(UnaryPredicate1D):
|
|||||||
self._sampling = sampling
|
self._sampling = sampling
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyLowDirectionalViewMapDensityUP1D"
|
return "pyLowDirectionalViewMapDensityUP1D"
|
||||||
|
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
func = GetDirectionalViewMapDensityF1D(self._orientation, self._level, self._integration, self._sampling)
|
func = GetDirectionalViewMapDensityF1D(self._orientation, self._level, self._integration, self._sampling)
|
||||||
v = func(inter)
|
v = func(inter)
|
||||||
if(v > self._threshold):
|
if v > self._threshold:
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -155,16 +140,14 @@ class pyHighViewMapDensityUP1D(UnaryPredicate1D):
|
|||||||
self._integration = integration
|
self._integration = integration
|
||||||
self._sampling = sampling
|
self._sampling = sampling
|
||||||
self._func = GetCompleteViewMapDensityF1D(self._level, self._integration, self._sampling) # 2.0 is the smpling
|
self._func = GetCompleteViewMapDensityF1D(self._level, self._integration, self._sampling) # 2.0 is the smpling
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyHighViewMapDensityUP1D"
|
return "pyHighViewMapDensityUP1D"
|
||||||
|
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
#print("toto")
|
#print("toto")
|
||||||
#print(func.getName())
|
#print(func.getName())
|
||||||
#print(inter.getExactTypeName())
|
#print(inter.getExactTypeName())
|
||||||
v= self._func(inter)
|
v= self._func(inter)
|
||||||
if(v > self._threshold):
|
if v > self._threshold:
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -177,15 +160,13 @@ class pyDensityFunctorUP1D(UnaryPredicate1D):
|
|||||||
self._funcmin = float(funcmin)
|
self._funcmin = float(funcmin)
|
||||||
self._funcmax = float(funcmax)
|
self._funcmax = float(funcmax)
|
||||||
self._integration = integration
|
self._integration = integration
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyDensityFunctorUP1D"
|
return "pyDensityFunctorUP1D"
|
||||||
|
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
func = DensityF1D(self._wsize, self._integration)
|
func = DensityF1D(self._wsize, self._integration)
|
||||||
res = self._functor(inter)
|
res = self._functor(inter)
|
||||||
k = (res-self._funcmin)/(self._funcmax-self._funcmin)
|
k = (res-self._funcmin)/(self._funcmax-self._funcmin)
|
||||||
if(func(inter) < self._threshold*k):
|
if func(inter) < self._threshold*k:
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -196,10 +177,9 @@ class pyZSmallerUP1D(UnaryPredicate1D):
|
|||||||
self._integration = integration
|
self._integration = integration
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyZSmallerUP1D"
|
return "pyZSmallerUP1D"
|
||||||
|
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
func = GetProjectedZF1D(self._integration)
|
func = GetProjectedZF1D(self._integration)
|
||||||
if(func(inter) < self._z):
|
if func(inter) < self._z:
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -213,32 +193,32 @@ class pyIsOccludedByUP1D(UnaryPredicate1D):
|
|||||||
func = GetShapeF1D()
|
func = GetShapeF1D()
|
||||||
shapes = func(inter)
|
shapes = func(inter)
|
||||||
for s in shapes:
|
for s in shapes:
|
||||||
if(s.getId() == self._id):
|
if(s.id == self._id):
|
||||||
return 0
|
return 0
|
||||||
it = inter.verticesBegin()
|
it = inter.vertices_begin()
|
||||||
itlast = inter.verticesEnd()
|
itlast = inter.vertices_end()
|
||||||
itlast.decrement()
|
itlast.decrement()
|
||||||
v = it.getObject()
|
v = it.getObject()
|
||||||
vlast = itlast.getObject()
|
vlast = itlast.getObject()
|
||||||
tvertex = v.viewvertex()
|
tvertex = v.viewvertex
|
||||||
if type(tvertex) is TVertex:
|
if type(tvertex) is TVertex:
|
||||||
print("TVertex: [ ", tvertex.getId().getFirst(), ",", tvertex.getId().getSecond()," ]")
|
print("TVertex: [ ", tvertex.id.first, ",", tvertex.id.second," ]")
|
||||||
eit = tvertex.edgesBegin()
|
eit = tvertex.edges_begin()
|
||||||
while(eit.isEnd() == 0):
|
while not eit.isEnd():
|
||||||
ve, incoming = eit.getObject()
|
ve, incoming = eit.getObject()
|
||||||
if(ve.getId() == self._id):
|
if ve.id == self._id:
|
||||||
return 1
|
return 1
|
||||||
print("-------", ve.getId().getFirst(), "-", ve.getId().getSecond())
|
print("-------", ve.id.first, "-", ve.id.second)
|
||||||
eit.increment()
|
eit.increment()
|
||||||
tvertex = vlast.viewvertex()
|
tvertex = vlast.viewvertex
|
||||||
if type(tvertex) is TVertex:
|
if type(tvertex) is TVertex:
|
||||||
print("TVertex: [ ", tvertex.getId().getFirst(), ",", tvertex.getId().getSecond()," ]")
|
print("TVertex: [ ", tvertex.id.first, ",", tvertex.id.second," ]")
|
||||||
eit = tvertex.edgesBegin()
|
eit = tvertex.edges_begin()
|
||||||
while(eit.isEnd() == 0):
|
while not eit.isEnd():
|
||||||
ve, incoming = eit.getObject()
|
ve, incoming = eit.getObject()
|
||||||
if(ve.getId() == self._id):
|
if ve.id == self._id:
|
||||||
return 1
|
return 1
|
||||||
print("-------", ve.getId().getFirst(), "-", ve.getId().getSecond())
|
print("-------", ve.id.first, "-", ve.id.second)
|
||||||
eit.increment()
|
eit.increment()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -252,7 +232,7 @@ class pyIsInOccludersListUP1D(UnaryPredicate1D):
|
|||||||
func = GetOccludersF1D()
|
func = GetOccludersF1D()
|
||||||
occluders = func(inter)
|
occluders = func(inter)
|
||||||
for a in occluders:
|
for a in occluders:
|
||||||
if(a.getId() == self._id):
|
if a.id == self._id:
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -268,7 +248,7 @@ class pyIsOccludedByItselfUP1D(UnaryPredicate1D):
|
|||||||
lst2 = self.__func2(inter)
|
lst2 = self.__func2(inter)
|
||||||
for vs1 in lst1:
|
for vs1 in lst1:
|
||||||
for vs2 in lst2:
|
for vs2 in lst2:
|
||||||
if vs1.getId() == vs2.getId():
|
if vs1.id == vs2.id:
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -282,8 +262,8 @@ class pyIsOccludedByIdListUP1D(UnaryPredicate1D):
|
|||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
lst1 = self.__func1(inter)
|
lst1 = self.__func1(inter)
|
||||||
for vs1 in lst1:
|
for vs1 in lst1:
|
||||||
for id in self._idlist:
|
for _id in self._idlist:
|
||||||
if vs1.getId() == id:
|
if vs1.id == _id:
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -292,29 +272,28 @@ class pyShapeIdListUP1D(UnaryPredicate1D):
|
|||||||
UnaryPredicate1D.__init__(self)
|
UnaryPredicate1D.__init__(self)
|
||||||
self._idlist = idlist
|
self._idlist = idlist
|
||||||
self._funcs = []
|
self._funcs = []
|
||||||
for id in idlist :
|
for _id in idlist :
|
||||||
self._funcs.append(ShapeUP1D(id.getFirst(), id.getSecond()))
|
self._funcs.append(ShapeUP1D(_id.first, _id.second))
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyShapeIdUP1D"
|
return "pyShapeIdUP1D"
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
for func in self._funcs :
|
for func in self._funcs :
|
||||||
if(func(inter) == 1) :
|
if func(inter) == 1:
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
## deprecated
|
## deprecated
|
||||||
class pyShapeIdUP1D(UnaryPredicate1D):
|
class pyShapeIdUP1D(UnaryPredicate1D):
|
||||||
def __init__(self,id):
|
def __init__(self, _id):
|
||||||
UnaryPredicate1D.__init__(self)
|
UnaryPredicate1D.__init__(self)
|
||||||
self._id = id
|
self._id = _id
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyShapeIdUP1D"
|
return "pyShapeIdUP1D"
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
func = GetShapeF1D()
|
func = GetShapeF1D()
|
||||||
shapes = func(inter)
|
shapes = func(inter)
|
||||||
for a in shapes:
|
for a in shapes:
|
||||||
if(a.getId() == self._id):
|
if a.id == self._id:
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -352,30 +331,28 @@ class pyDensityVariableSigmaUP1D(UnaryPredicate1D):
|
|||||||
self._tmax = tmax
|
self._tmax = tmax
|
||||||
self._integration = integration
|
self._integration = integration
|
||||||
self._sampling = sampling
|
self._sampling = sampling
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "pyDensityUP1D"
|
return "pyDensityUP1D"
|
||||||
|
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
sigma = (self._sigmaMax-self._sigmaMin)/(self._lmax-self._lmin)*(self._functor(inter)-self._lmin) + self._sigmaMin
|
sigma = (self._sigmaMax-self._sigmaMin)/(self._lmax-self._lmin)*(self._functor(inter)-self._lmin) + self._sigmaMin
|
||||||
t = (self._tmax-self._tmin)/(self._lmax-self._lmin)*(self._functor(inter)-self._lmin) + self._tmin
|
t = (self._tmax-self._tmin)/(self._lmax-self._lmin)*(self._functor(inter)-self._lmin) + self._tmin
|
||||||
if(sigma<self._sigmaMin):
|
if sigma < self._sigmaMin:
|
||||||
sigma = self._sigmaMin
|
sigma = self._sigmaMin
|
||||||
self._func = DensityF1D(sigma, self._integration, self._sampling)
|
self._func = DensityF1D(sigma, self._integration, self._sampling)
|
||||||
d = self._func(inter)
|
d = self._func(inter)
|
||||||
if(d<t):
|
if d < t:
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
class pyClosedCurveUP1D(UnaryPredicate1D):
|
class pyClosedCurveUP1D(UnaryPredicate1D):
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
it = inter.verticesBegin()
|
it = inter.vertices_begin()
|
||||||
itlast = inter.verticesEnd()
|
itlast = inter.vertices_end()
|
||||||
itlast.decrement()
|
itlast.decrement()
|
||||||
vlast = itlast.getObject()
|
vlast = itlast.getObject()
|
||||||
v = it.getObject()
|
v = it.getObject()
|
||||||
print(v.getId().getFirst(), v.getId().getSecond())
|
print(v.id.first, v.id.second)
|
||||||
print(vlast.getId().getFirst(), vlast.getId().getSecond())
|
print(vlast.id.first, vlast.id.second)
|
||||||
if(v.getId() == vlast.getId()):
|
if v.id == vlast.id:
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -93,19 +93,19 @@ class ThicknessModifierMixIn:
|
|||||||
scene = Freestyle.getCurrentScene()
|
scene = Freestyle.getCurrentScene()
|
||||||
self.__persp_camera = (scene.camera.data.type == "PERSP")
|
self.__persp_camera = (scene.camera.data.type == "PERSP")
|
||||||
def set_thickness(self, sv, outer, inner):
|
def set_thickness(self, sv, outer, inner):
|
||||||
fe = sv.A().getFEdge(sv.B())
|
fe = sv.first_svertex.get_fedge(sv.second_svertex)
|
||||||
nature = fe.getNature()
|
nature = fe.nature
|
||||||
if (nature & Nature.BORDER):
|
if (nature & Nature.BORDER):
|
||||||
if self.__persp_camera:
|
if self.__persp_camera:
|
||||||
point = -sv.getPoint3D()
|
point = -sv.point_3d.copy()
|
||||||
point.normalize()
|
point.normalize()
|
||||||
dir = point.dot(fe.normalB())
|
dir = point.dot(fe.normal_left)
|
||||||
else:
|
else:
|
||||||
dir = fe.normalB().z
|
dir = fe.normal_left.z
|
||||||
if dir < 0.0: # the back side is visible
|
if dir < 0.0: # the back side is visible
|
||||||
outer, inner = inner, outer
|
outer, inner = inner, outer
|
||||||
elif (nature & Nature.SILHOUETTE):
|
elif (nature & Nature.SILHOUETTE):
|
||||||
if fe.isSmooth(): # TODO more tests needed
|
if fe.is_smooth: # TODO more tests needed
|
||||||
outer, inner = inner, outer
|
outer, inner = inner, outer
|
||||||
else:
|
else:
|
||||||
outer = inner = (outer + inner) / 2
|
outer = inner = (outer + inner) / 2
|
||||||
@@ -158,7 +158,7 @@ class BaseThicknessShader(StrokeShader, ThicknessModifierMixIn):
|
|||||||
def getName(self):
|
def getName(self):
|
||||||
return "BaseThicknessShader"
|
return "BaseThicknessShader"
|
||||||
def shade(self, stroke):
|
def shade(self, stroke):
|
||||||
it = stroke.strokeVerticesBegin()
|
it = stroke.stroke_vertices_begin()
|
||||||
while it.isEnd() == 0:
|
while it.isEnd() == 0:
|
||||||
sv = it.getObject()
|
sv = it.getObject()
|
||||||
self.set_thickness(sv, self.__outer, self.__inner)
|
self.set_thickness(sv, self.__outer, self.__inner)
|
||||||
@@ -167,9 +167,9 @@ class BaseThicknessShader(StrokeShader, ThicknessModifierMixIn):
|
|||||||
# Along Stroke modifiers
|
# Along Stroke modifiers
|
||||||
|
|
||||||
def iter_t2d_along_stroke(stroke):
|
def iter_t2d_along_stroke(stroke):
|
||||||
total = stroke.getLength2D()
|
total = stroke.length_2d
|
||||||
distance = 0.0
|
distance = 0.0
|
||||||
it = stroke.strokeVerticesBegin()
|
it = stroke.stroke_vertices_begin()
|
||||||
while not it.isEnd():
|
while not it.isEnd():
|
||||||
p = it.getObject().point
|
p = it.getObject().point
|
||||||
if not it.isBegin():
|
if not it.isBegin():
|
||||||
@@ -220,9 +220,9 @@ class ThicknessAlongStrokeShader(ThicknessBlenderMixIn, CurveMappingModifier):
|
|||||||
|
|
||||||
def iter_distance_from_camera(stroke, range_min, range_max):
|
def iter_distance_from_camera(stroke, range_min, range_max):
|
||||||
normfac = range_max - range_min # normalization factor
|
normfac = range_max - range_min # normalization factor
|
||||||
it = stroke.strokeVerticesBegin()
|
it = stroke.stroke_vertices_begin()
|
||||||
while not it.isEnd():
|
while not it.isEnd():
|
||||||
p = it.getObject().getPoint3D() # in the camera coordinate
|
p = it.getObject().point_3d # in the camera coordinate
|
||||||
distance = p.length
|
distance = p.length
|
||||||
if distance < range_min:
|
if distance < range_min:
|
||||||
t = 0.0
|
t = 0.0
|
||||||
@@ -288,9 +288,9 @@ def iter_distance_from_object(stroke, object, range_min, range_max):
|
|||||||
mv.invert()
|
mv.invert()
|
||||||
loc = mv * object.location # loc in the camera coordinate
|
loc = mv * object.location # loc in the camera coordinate
|
||||||
normfac = range_max - range_min # normalization factor
|
normfac = range_max - range_min # normalization factor
|
||||||
it = stroke.strokeVerticesBegin()
|
it = stroke.stroke_vertices_begin()
|
||||||
while not it.isEnd():
|
while not it.isEnd():
|
||||||
p = it.getObject().getPoint3D() # in the camera coordinate
|
p = it.getObject().point_3d # in the camera coordinate
|
||||||
distance = (p - loc).length
|
distance = (p - loc).length
|
||||||
if distance < range_min:
|
if distance < range_min:
|
||||||
t = 0.0
|
t = 0.0
|
||||||
@@ -361,7 +361,7 @@ class ThicknessDistanceFromObjectShader(ThicknessBlenderMixIn, CurveMappingModif
|
|||||||
|
|
||||||
def iter_material_color(stroke, material_attr):
|
def iter_material_color(stroke, material_attr):
|
||||||
func = CurveMaterialF0D()
|
func = CurveMaterialF0D()
|
||||||
it = stroke.strokeVerticesBegin()
|
it = stroke.stroke_vertices_begin()
|
||||||
while not it.isEnd():
|
while not it.isEnd():
|
||||||
material = func(it.castToInterface0DIterator())
|
material = func(it.castToInterface0DIterator())
|
||||||
if material_attr == "DIFF":
|
if material_attr == "DIFF":
|
||||||
@@ -379,7 +379,7 @@ def iter_material_color(stroke, material_attr):
|
|||||||
|
|
||||||
def iter_material_value(stroke, material_attr):
|
def iter_material_value(stroke, material_attr):
|
||||||
func = CurveMaterialF0D()
|
func = CurveMaterialF0D()
|
||||||
it = stroke.strokeVerticesBegin()
|
it = stroke.stroke_vertices_begin()
|
||||||
while not it.isEnd():
|
while not it.isEnd():
|
||||||
material = func(it.castToInterface0DIterator())
|
material = func(it.castToInterface0DIterator())
|
||||||
if material_attr == "DIFF":
|
if material_attr == "DIFF":
|
||||||
@@ -405,7 +405,7 @@ def iter_material_value(stroke, material_attr):
|
|||||||
elif material_attr == "SPEC_B":
|
elif material_attr == "SPEC_B":
|
||||||
t = material.specular[2]
|
t = material.specular[2]
|
||||||
elif material_attr == "SPEC_HARDNESS":
|
elif material_attr == "SPEC_HARDNESS":
|
||||||
t = material.shininess()
|
t = material.shininess
|
||||||
elif material_attr == "ALPHA":
|
elif material_attr == "ALPHA":
|
||||||
t = material.diffuse[3]
|
t = material.diffuse[3]
|
||||||
else:
|
else:
|
||||||
@@ -476,7 +476,7 @@ class CalligraphicThicknessShader(ThicknessBlenderMixIn, ScalarBlendModifier):
|
|||||||
self.__max_thickness = max_thickness
|
self.__max_thickness = max_thickness
|
||||||
def shade(self, stroke):
|
def shade(self, stroke):
|
||||||
func = VertexOrientation2DF0D()
|
func = VertexOrientation2DF0D()
|
||||||
it = stroke.strokeVerticesBegin()
|
it = stroke.stroke_vertices_begin()
|
||||||
while not it.isEnd():
|
while not it.isEnd():
|
||||||
dir = func(it.castToInterface0DIterator())
|
dir = func(it.castToInterface0DIterator())
|
||||||
orthDir = mathutils.Vector((-dir.y, dir.x))
|
orthDir = mathutils.Vector((-dir.y, dir.x))
|
||||||
@@ -494,7 +494,7 @@ class CalligraphicThicknessShader(ThicknessBlenderMixIn, ScalarBlendModifier):
|
|||||||
|
|
||||||
def iter_distance_along_stroke(stroke):
|
def iter_distance_along_stroke(stroke):
|
||||||
distance = 0.0
|
distance = 0.0
|
||||||
it = stroke.strokeVerticesBegin()
|
it = stroke.stroke_vertices_begin()
|
||||||
while not it.isEnd():
|
while not it.isEnd():
|
||||||
p = it.getObject().point
|
p = it.getObject().point
|
||||||
if not it.isBegin():
|
if not it.isBegin():
|
||||||
@@ -518,7 +518,7 @@ class SinusDisplacementShader(StrokeShader):
|
|||||||
n = self._getNormal(it.castToInterface0DIterator())
|
n = self._getNormal(it.castToInterface0DIterator())
|
||||||
n = n * self._amplitude * math.cos(distance / self._wavelength * 2 * math.pi + self._phase)
|
n = n * self._amplitude * math.cos(distance / self._wavelength * 2 * math.pi + self._phase)
|
||||||
v.point = v.point + n
|
v.point = v.point + n
|
||||||
stroke.UpdateLength()
|
stroke.update_length()
|
||||||
|
|
||||||
class PerlinNoise1DShader(StrokeShader):
|
class PerlinNoise1DShader(StrokeShader):
|
||||||
def __init__(self, freq = 10, amp = 10, oct = 4, angle = math.radians(45), seed = -1):
|
def __init__(self, freq = 10, amp = 10, oct = 4, angle = math.radians(45), seed = -1):
|
||||||
@@ -531,14 +531,14 @@ class PerlinNoise1DShader(StrokeShader):
|
|||||||
def getName(self):
|
def getName(self):
|
||||||
return "PerlinNoise1DShader"
|
return "PerlinNoise1DShader"
|
||||||
def shade(self, stroke):
|
def shade(self, stroke):
|
||||||
length = stroke.getLength2D()
|
length = stroke.length_2d
|
||||||
it = stroke.strokeVerticesBegin()
|
it = stroke.stroke_vertices_begin()
|
||||||
while not it.isEnd():
|
while not it.isEnd():
|
||||||
v = it.getObject()
|
v = it.getObject()
|
||||||
nres = self.__noise.turbulence1(length * v.u, self.__freq, self.__amp, self.__oct)
|
nres = self.__noise.turbulence1(length * v.u, self.__freq, self.__amp, self.__oct)
|
||||||
v.point = v.point + nres * self.__dir
|
v.point = v.point + nres * self.__dir
|
||||||
it.increment()
|
it.increment()
|
||||||
stroke.UpdateLength()
|
stroke.update_length()
|
||||||
|
|
||||||
class PerlinNoise2DShader(StrokeShader):
|
class PerlinNoise2DShader(StrokeShader):
|
||||||
def __init__(self, freq = 10, amp = 10, oct = 4, angle = math.radians(45), seed = -1):
|
def __init__(self, freq = 10, amp = 10, oct = 4, angle = math.radians(45), seed = -1):
|
||||||
@@ -551,14 +551,14 @@ class PerlinNoise2DShader(StrokeShader):
|
|||||||
def getName(self):
|
def getName(self):
|
||||||
return "PerlinNoise2DShader"
|
return "PerlinNoise2DShader"
|
||||||
def shade(self, stroke):
|
def shade(self, stroke):
|
||||||
it = stroke.strokeVerticesBegin()
|
it = stroke.stroke_vertices_begin()
|
||||||
while not it.isEnd():
|
while not it.isEnd():
|
||||||
v = it.getObject()
|
v = it.getObject()
|
||||||
vec = Vector([v.getProjectedX(), v.getProjectedY()]) # FIXME
|
vec = Vector([v.projected_x, v.projected_y])
|
||||||
nres = self.__noise.turbulence2(vec, self.__freq, self.__amp, self.__oct)
|
nres = self.__noise.turbulence2(vec, self.__freq, self.__amp, self.__oct)
|
||||||
v.point = v.point + nres * self.__dir
|
v.point = v.point + nres * self.__dir
|
||||||
it.increment()
|
it.increment()
|
||||||
stroke.UpdateLength()
|
stroke.update_length()
|
||||||
|
|
||||||
class Offset2DShader(StrokeShader):
|
class Offset2DShader(StrokeShader):
|
||||||
def __init__(self, start, end, x, y):
|
def __init__(self, start, end, x, y):
|
||||||
@@ -570,7 +570,7 @@ class Offset2DShader(StrokeShader):
|
|||||||
def getName(self):
|
def getName(self):
|
||||||
return "Offset2DShader"
|
return "Offset2DShader"
|
||||||
def shade(self, stroke):
|
def shade(self, stroke):
|
||||||
it = stroke.strokeVerticesBegin()
|
it = stroke.stroke_vertices_begin()
|
||||||
while not it.isEnd():
|
while not it.isEnd():
|
||||||
v = it.getObject()
|
v = it.getObject()
|
||||||
u = v.u
|
u = v.u
|
||||||
@@ -579,7 +579,7 @@ class Offset2DShader(StrokeShader):
|
|||||||
n = n * a
|
n = n * a
|
||||||
v.point = v.point + n + self.__xy
|
v.point = v.point + n + self.__xy
|
||||||
it.increment()
|
it.increment()
|
||||||
stroke.UpdateLength()
|
stroke.update_length()
|
||||||
|
|
||||||
class Transform2DShader(StrokeShader):
|
class Transform2DShader(StrokeShader):
|
||||||
def __init__(self, pivot, scale_x, scale_y, angle, pivot_u, pivot_x, pivot_y):
|
def __init__(self, pivot, scale_x, scale_y, angle, pivot_u, pivot_x, pivot_y):
|
||||||
@@ -596,15 +596,15 @@ class Transform2DShader(StrokeShader):
|
|||||||
def shade(self, stroke):
|
def shade(self, stroke):
|
||||||
# determine the pivot of scaling and rotation operations
|
# determine the pivot of scaling and rotation operations
|
||||||
if self.__pivot == "START":
|
if self.__pivot == "START":
|
||||||
it = stroke.strokeVerticesBegin()
|
it = stroke.stroke_vertices_begin()
|
||||||
pivot = it.getObject().point
|
pivot = it.getObject().point
|
||||||
elif self.__pivot == "END":
|
elif self.__pivot == "END":
|
||||||
it = stroke.strokeVerticesEnd()
|
it = stroke.stroke_vertices_end()
|
||||||
it.decrement()
|
it.decrement()
|
||||||
pivot = it.getObject().point
|
pivot = it.getObject().point
|
||||||
elif self.__pivot == "PARAM":
|
elif self.__pivot == "PARAM":
|
||||||
p = None
|
p = None
|
||||||
it = stroke.strokeVerticesBegin()
|
it = stroke.stroke_vertices_begin()
|
||||||
while not it.isEnd():
|
while not it.isEnd():
|
||||||
prev = p
|
prev = p
|
||||||
v = it.getObject()
|
v = it.getObject()
|
||||||
@@ -621,7 +621,7 @@ class Transform2DShader(StrokeShader):
|
|||||||
elif self.__pivot == "CENTER":
|
elif self.__pivot == "CENTER":
|
||||||
pivot = Vector([0.0, 0.0])
|
pivot = Vector([0.0, 0.0])
|
||||||
n = 0
|
n = 0
|
||||||
it = stroke.strokeVerticesBegin()
|
it = stroke.stroke_vertices_begin()
|
||||||
while not it.isEnd():
|
while not it.isEnd():
|
||||||
p = it.getObject().point
|
p = it.getObject().point
|
||||||
pivot = pivot + p
|
pivot = pivot + p
|
||||||
@@ -634,7 +634,7 @@ class Transform2DShader(StrokeShader):
|
|||||||
# apply scaling and rotation operations
|
# apply scaling and rotation operations
|
||||||
cos_theta = math.cos(self.__angle)
|
cos_theta = math.cos(self.__angle)
|
||||||
sin_theta = math.sin(self.__angle)
|
sin_theta = math.sin(self.__angle)
|
||||||
it = stroke.strokeVerticesBegin()
|
it = stroke.stroke_vertices_begin()
|
||||||
while not it.isEnd():
|
while not it.isEnd():
|
||||||
v = it.getObject()
|
v = it.getObject()
|
||||||
p = v.point
|
p = v.point
|
||||||
@@ -645,7 +645,7 @@ class Transform2DShader(StrokeShader):
|
|||||||
p.y = x * sin_theta + y * cos_theta
|
p.y = x * sin_theta + y * cos_theta
|
||||||
v.point = p + pivot
|
v.point = p + pivot
|
||||||
it.increment()
|
it.increment()
|
||||||
stroke.UpdateLength()
|
stroke.update_length()
|
||||||
|
|
||||||
# Predicates and helper functions
|
# Predicates and helper functions
|
||||||
|
|
||||||
@@ -677,7 +677,7 @@ class ObjectNamesUP1D(UnaryPredicate1D):
|
|||||||
def getName(self):
|
def getName(self):
|
||||||
return "ObjectNamesUP1D"
|
return "ObjectNamesUP1D"
|
||||||
def __call__(self, viewEdge):
|
def __call__(self, viewEdge):
|
||||||
found = viewEdge.viewShape().getName() in self._names
|
found = viewEdge.viewshape.name in self._names
|
||||||
if self._negative:
|
if self._negative:
|
||||||
return not found
|
return not found
|
||||||
return found
|
return found
|
||||||
@@ -685,7 +685,7 @@ class ObjectNamesUP1D(UnaryPredicate1D):
|
|||||||
# Stroke caps
|
# Stroke caps
|
||||||
|
|
||||||
def iter_stroke_vertices(stroke):
|
def iter_stroke_vertices(stroke):
|
||||||
it = stroke.strokeVerticesBegin()
|
it = stroke.stroke_vertices_begin()
|
||||||
prev_p = None
|
prev_p = None
|
||||||
while not it.isEnd():
|
while not it.isEnd():
|
||||||
sv = it.getObject()
|
sv = it.getObject()
|
||||||
@@ -715,7 +715,7 @@ class RoundCapShader(StrokeShader):
|
|||||||
caplen_end = (R + L) / 2.0
|
caplen_end = (R + L) / 2.0
|
||||||
nverts_end = max(5, int(R + L))
|
nverts_end = max(5, int(R + L))
|
||||||
# adjust the total number of stroke vertices
|
# adjust the total number of stroke vertices
|
||||||
stroke.Resample(nverts + nverts_beg + nverts_end)
|
stroke.resample(nverts + nverts_beg + nverts_end)
|
||||||
# restore the location and attribute of the original vertices
|
# restore the location and attribute of the original vertices
|
||||||
for i in range(nverts):
|
for i in range(nverts):
|
||||||
p, attr = buffer[i]
|
p, attr = buffer[i]
|
||||||
@@ -748,7 +748,7 @@ class RoundCapShader(StrokeShader):
|
|||||||
stroke[-i-1].attribute = attr
|
stroke[-i-1].attribute = attr
|
||||||
stroke[-i-1].attribute.thickness = (R * r, L * r)
|
stroke[-i-1].attribute.thickness = (R * r, L * r)
|
||||||
# update the curvilinear 2D length of each vertex
|
# update the curvilinear 2D length of each vertex
|
||||||
stroke.UpdateLength()
|
stroke.update_length()
|
||||||
|
|
||||||
class SquareCapShader(StrokeShader):
|
class SquareCapShader(StrokeShader):
|
||||||
def shade(self, stroke):
|
def shade(self, stroke):
|
||||||
@@ -767,7 +767,7 @@ class SquareCapShader(StrokeShader):
|
|||||||
caplen_end = (R + L) / 2.0
|
caplen_end = (R + L) / 2.0
|
||||||
nverts_end = 1
|
nverts_end = 1
|
||||||
# adjust the total number of stroke vertices
|
# adjust the total number of stroke vertices
|
||||||
stroke.Resample(nverts + nverts_beg + nverts_end)
|
stroke.resample(nverts + nverts_beg + nverts_end)
|
||||||
# restore the location and attribute of the original vertices
|
# restore the location and attribute of the original vertices
|
||||||
for i in range(nverts):
|
for i in range(nverts):
|
||||||
p, attr = buffer[i]
|
p, attr = buffer[i]
|
||||||
@@ -786,7 +786,7 @@ class SquareCapShader(StrokeShader):
|
|||||||
stroke[-1].point = p + d / d.length * caplen_beg
|
stroke[-1].point = p + d / d.length * caplen_beg
|
||||||
stroke[-1].attribute = attr
|
stroke[-1].attribute = attr
|
||||||
# update the curvilinear 2D length of each vertex
|
# update the curvilinear 2D length of each vertex
|
||||||
stroke.UpdateLength()
|
stroke.update_length()
|
||||||
|
|
||||||
# Split by dashed line pattern
|
# Split by dashed line pattern
|
||||||
|
|
||||||
@@ -847,7 +847,7 @@ class DashedLineShader(StrokeShader):
|
|||||||
start = 0.0 # 2D curvilinear length
|
start = 0.0 # 2D curvilinear length
|
||||||
visible = True
|
visible = True
|
||||||
sampling = 1.0
|
sampling = 1.0
|
||||||
it = stroke.strokeVerticesBegin(sampling)
|
it = stroke.stroke_vertices_begin(sampling)
|
||||||
while not it.isEnd():
|
while not it.isEnd():
|
||||||
pos = it.t()
|
pos = it.t()
|
||||||
# The extra 'sampling' term is added below, because the
|
# The extra 'sampling' term is added below, because the
|
||||||
@@ -872,14 +872,10 @@ class AngleLargerThanBP1D(BinaryPredicate1D):
|
|||||||
def getName(self):
|
def getName(self):
|
||||||
return "AngleLargerThanBP1D"
|
return "AngleLargerThanBP1D"
|
||||||
def __call__(self, i1, i2):
|
def __call__(self, i1, i2):
|
||||||
fe1a = i1.fedgeA()
|
sv1a = i1.first_fedge.first_svertex.point_2d
|
||||||
fe1b = i1.fedgeB()
|
sv1b = i1.last_fedge.second_svertex.point_2d
|
||||||
fe2a = i2.fedgeA()
|
sv2a = i2.first_fedge.first_svertex.point_2d
|
||||||
fe2b = i2.fedgeB()
|
sv2b = i2.last_fedge.second_svertex.point_2d
|
||||||
sv1a = fe1a.vertexA().getPoint2D()
|
|
||||||
sv1b = fe1b.vertexB().getPoint2D()
|
|
||||||
sv2a = fe2a.vertexA().getPoint2D()
|
|
||||||
sv2b = fe2b.vertexB().getPoint2D()
|
|
||||||
if (sv1a - sv2a).length < 1e-6:
|
if (sv1a - sv2a).length < 1e-6:
|
||||||
dir1 = sv1a - sv1b
|
dir1 = sv1a - sv1b
|
||||||
dir2 = sv2b - sv2a
|
dir2 = sv2b - sv2a
|
||||||
@@ -920,7 +916,7 @@ class LengthThresholdUP1D(UnaryPredicate1D):
|
|||||||
def getName(self):
|
def getName(self):
|
||||||
return "LengthThresholdUP1D"
|
return "LengthThresholdUP1D"
|
||||||
def __call__(self, inter):
|
def __call__(self, inter):
|
||||||
length = inter.getLength2D()
|
length = inter.length_2d
|
||||||
if self._min_length is not None and length < self._min_length:
|
if self._min_length is not None and length < self._min_length:
|
||||||
return False
|
return False
|
||||||
if self._max_length is not None and length > self._max_length:
|
if self._max_length is not None and length > self._max_length:
|
||||||
@@ -929,28 +925,28 @@ class LengthThresholdUP1D(UnaryPredicate1D):
|
|||||||
|
|
||||||
class FaceMarkBothUP1D(UnaryPredicate1D):
|
class FaceMarkBothUP1D(UnaryPredicate1D):
|
||||||
def __call__(self, inter): # ViewEdge
|
def __call__(self, inter): # ViewEdge
|
||||||
fe = inter.fedgeA()
|
fe = inter.first_fedge
|
||||||
while fe is not None:
|
while fe is not None:
|
||||||
if fe.isSmooth():
|
if fe.is_smooth:
|
||||||
if fe.faceMark():
|
if fe.face_mark:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
if fe.aFaceMark() and fe.bFaceMark():
|
if fe.face_mark_right and fe.face_mark_left:
|
||||||
return True
|
return True
|
||||||
fe = fe.nextEdge()
|
fe = fe.next_fedge
|
||||||
return False
|
return False
|
||||||
|
|
||||||
class FaceMarkOneUP1D(UnaryPredicate1D):
|
class FaceMarkOneUP1D(UnaryPredicate1D):
|
||||||
def __call__(self, inter): # ViewEdge
|
def __call__(self, inter): # ViewEdge
|
||||||
fe = inter.fedgeA()
|
fe = inter.first_fedge
|
||||||
while fe is not None:
|
while fe is not None:
|
||||||
if fe.isSmooth():
|
if fe.is_smooth:
|
||||||
if fe.faceMark():
|
if fe.face_mark:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
if fe.aFaceMark() or fe.bFaceMark():
|
if fe.face_mark_right or fe.face_mark_left:
|
||||||
return True
|
return True
|
||||||
fe = fe.nextEdge()
|
fe = fe.next_fedge
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# predicates for splitting
|
# predicates for splitting
|
||||||
@@ -967,10 +963,10 @@ class MaterialBoundaryUP0D(UnaryPredicate0D):
|
|||||||
it.increment()
|
it.increment()
|
||||||
if it.isEnd():
|
if it.isEnd():
|
||||||
return False
|
return False
|
||||||
fe = v.getFEdge(it_prev.getObject())
|
fe = v.get_fedge(it_prev.getObject())
|
||||||
idx1 = fe.materialIndex() if fe.isSmooth() else fe.bMaterialIndex()
|
idx1 = fe.material_index if fe.is_smooth else fe.material_index_left
|
||||||
fe = v.getFEdge(it.getObject())
|
fe = v.get_fedge(it.getObject())
|
||||||
idx2 = fe.materialIndex() if fe.isSmooth() else fe.bMaterialIndex()
|
idx2 = fe.material_index if fe.is_smooth else fe.material_index_left
|
||||||
return idx1 != idx2
|
return idx1 != idx2
|
||||||
|
|
||||||
class Curvature2DAngleThresholdUP0D(UnaryPredicate0D):
|
class Curvature2DAngleThresholdUP0D(UnaryPredicate0D):
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -76,68 +76,6 @@ static PyObject * Id___repr__(BPy_Id* self)
|
|||||||
return PyUnicode_FromFormat("[ first: %i, second: %i ](BPy_Id)", self->id->getFirst(), self->id->getSecond() );
|
return PyUnicode_FromFormat("[ first: %i, second: %i ](BPy_Id)", self->id->getFirst(), self->id->getSecond() );
|
||||||
}
|
}
|
||||||
|
|
||||||
static char Id_getFirst___doc__[] =
|
|
||||||
".. method:: getFirst()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the first Id number.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The first Id number.\n"
|
|
||||||
" :rtype: int\n";
|
|
||||||
|
|
||||||
static PyObject *Id_getFirst( BPy_Id *self ) {
|
|
||||||
return PyLong_FromLong( self->id->getFirst() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Id_getSecond___doc__[] =
|
|
||||||
".. method:: getSecond()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the second Id number.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The second Id number.\n"
|
|
||||||
" :rtype: int\n";
|
|
||||||
|
|
||||||
static PyObject *Id_getSecond( BPy_Id *self) {
|
|
||||||
return PyLong_FromLong( self->id->getSecond() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Id_setFirst___doc__[] =
|
|
||||||
".. method:: setFirst(iFirst)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the first number constituting the Id.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iFirst: The first number constituting the Id.\n"
|
|
||||||
" :type iFirst: int\n";
|
|
||||||
|
|
||||||
static PyObject *Id_setFirst( BPy_Id *self , PyObject *args) {
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
if( !PyArg_ParseTuple(args, "i", &i) )
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->id->setFirst( i );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Id_setSecond___doc__[] =
|
|
||||||
".. method:: setSecond(iSecond)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the second number constituting the Id.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iSecond: The second number constituting the Id.\n"
|
|
||||||
" :type iSecond: int\n";
|
|
||||||
|
|
||||||
static PyObject *Id_setSecond( BPy_Id *self , PyObject *args) {
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
if( !PyArg_ParseTuple(args, "i", &i) )
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->id->setSecond( i );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject * Id_RichCompare(BPy_Id *o1, BPy_Id *o2, int opid) {
|
static PyObject * Id_RichCompare(BPy_Id *o1, BPy_Id *o2, int opid) {
|
||||||
switch(opid){
|
switch(opid){
|
||||||
case Py_LT:
|
case Py_LT:
|
||||||
@@ -165,13 +103,61 @@ static PyObject * Id_RichCompare(BPy_Id *o1, BPy_Id *o2, int opid) {
|
|||||||
|
|
||||||
/*----------------------Id instance definitions ----------------------------*/
|
/*----------------------Id instance definitions ----------------------------*/
|
||||||
static PyMethodDef BPy_Id_methods[] = {
|
static PyMethodDef BPy_Id_methods[] = {
|
||||||
{"getFirst", ( PyCFunction ) Id_getFirst, METH_NOARGS, Id_getFirst___doc__},
|
|
||||||
{"getSecond", ( PyCFunction ) Id_getSecond, METH_NOARGS, Id_getSecond___doc__},
|
|
||||||
{"setFirst", ( PyCFunction ) Id_setFirst, METH_VARARGS, Id_setFirst___doc__},
|
|
||||||
{"setSecond", ( PyCFunction ) Id_setSecond, METH_VARARGS, Id_setSecond___doc__},
|
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*----------------------Id get/setters ----------------------------*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Id_first_doc,
|
||||||
|
"The first number constituting the Id.\n"
|
||||||
|
"\n"
|
||||||
|
":type: int"
|
||||||
|
);
|
||||||
|
|
||||||
|
static PyObject *Id_first_get(BPy_Id *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyLong_FromLong(self->id->getFirst());
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Id_first_set(BPy_Id *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
int scalar;
|
||||||
|
if ((scalar = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be an integer");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->id->setFirst(scalar);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Id_second_doc,
|
||||||
|
"The second number constituting the Id.\n"
|
||||||
|
"\n"
|
||||||
|
":type: int"
|
||||||
|
);
|
||||||
|
|
||||||
|
static PyObject *Id_second_get(BPy_Id *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyLong_FromLong(self->id->getSecond());
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Id_second_set(BPy_Id *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
int scalar;
|
||||||
|
if ((scalar = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be an integer");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->id->setSecond(scalar);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyGetSetDef BPy_Id_getseters[] = {
|
||||||
|
{(char *)"first", (getter)Id_first_get, (setter)Id_first_set, (char *)Id_first_doc, NULL},
|
||||||
|
{(char *)"second", (getter)Id_second_get, (setter)Id_second_set, (char *)Id_second_doc, NULL},
|
||||||
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||||
|
};
|
||||||
|
|
||||||
/*-----------------------BPy_Id type definition ------------------------------*/
|
/*-----------------------BPy_Id type definition ------------------------------*/
|
||||||
|
|
||||||
PyTypeObject Id_Type = {
|
PyTypeObject Id_Type = {
|
||||||
@@ -204,7 +190,7 @@ PyTypeObject Id_Type = {
|
|||||||
0, /* tp_iternext */
|
0, /* tp_iternext */
|
||||||
BPy_Id_methods, /* tp_methods */
|
BPy_Id_methods, /* tp_methods */
|
||||||
0, /* tp_members */
|
0, /* tp_members */
|
||||||
0, /* tp_getset */
|
BPy_Id_getseters, /* tp_getset */
|
||||||
0, /* tp_base */
|
0, /* tp_base */
|
||||||
0, /* tp_dict */
|
0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
|
|||||||
@@ -17,215 +17,84 @@ extern "C" {
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//-------------------MODULE INITIALIZATION--------------------------------
|
//-------------------MODULE INITIALIZATION--------------------------------
|
||||||
int Interface0D_Init( PyObject *module )
|
int Interface0D_Init(PyObject *module)
|
||||||
{
|
{
|
||||||
if( module == NULL )
|
if (module == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( PyType_Ready( &Interface0D_Type ) < 0 )
|
if (PyType_Ready(&Interface0D_Type) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
Py_INCREF( &Interface0D_Type );
|
Py_INCREF(&Interface0D_Type);
|
||||||
PyModule_AddObject(module, "Interface0D", (PyObject *)&Interface0D_Type);
|
PyModule_AddObject(module, "Interface0D", (PyObject *)&Interface0D_Type);
|
||||||
|
|
||||||
if( PyType_Ready( &CurvePoint_Type ) < 0 )
|
if (PyType_Ready(&CurvePoint_Type) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
Py_INCREF( &CurvePoint_Type );
|
Py_INCREF(&CurvePoint_Type);
|
||||||
PyModule_AddObject(module, "CurvePoint", (PyObject *)&CurvePoint_Type);
|
PyModule_AddObject(module, "CurvePoint", (PyObject *)&CurvePoint_Type);
|
||||||
|
|
||||||
if( PyType_Ready( &SVertex_Type ) < 0 )
|
if (PyType_Ready(&SVertex_Type) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
Py_INCREF( &SVertex_Type );
|
Py_INCREF(&SVertex_Type);
|
||||||
PyModule_AddObject(module, "SVertex", (PyObject *)&SVertex_Type);
|
PyModule_AddObject(module, "SVertex", (PyObject *)&SVertex_Type);
|
||||||
|
|
||||||
if( PyType_Ready( &ViewVertex_Type ) < 0 )
|
if (PyType_Ready(&ViewVertex_Type) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
Py_INCREF( &ViewVertex_Type );
|
Py_INCREF(&ViewVertex_Type);
|
||||||
PyModule_AddObject(module, "ViewVertex", (PyObject *)&ViewVertex_Type);
|
PyModule_AddObject(module, "ViewVertex", (PyObject *)&ViewVertex_Type);
|
||||||
|
|
||||||
if( PyType_Ready( &StrokeVertex_Type ) < 0 )
|
if (PyType_Ready(&StrokeVertex_Type) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
Py_INCREF( &StrokeVertex_Type );
|
Py_INCREF(&StrokeVertex_Type);
|
||||||
PyModule_AddObject(module, "StrokeVertex", (PyObject *)&StrokeVertex_Type);
|
PyModule_AddObject(module, "StrokeVertex", (PyObject *)&StrokeVertex_Type);
|
||||||
|
|
||||||
if( PyType_Ready( &NonTVertex_Type ) < 0 )
|
if (PyType_Ready(&NonTVertex_Type) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
Py_INCREF( &NonTVertex_Type );
|
Py_INCREF(&NonTVertex_Type);
|
||||||
PyModule_AddObject(module, "NonTVertex", (PyObject *)&NonTVertex_Type);
|
PyModule_AddObject(module, "NonTVertex", (PyObject *)&NonTVertex_Type);
|
||||||
|
|
||||||
if( PyType_Ready( &TVertex_Type ) < 0 )
|
if (PyType_Ready(&TVertex_Type) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
Py_INCREF( &TVertex_Type );
|
Py_INCREF(&TVertex_Type);
|
||||||
PyModule_AddObject(module, "TVertex", (PyObject *)&TVertex_Type);
|
PyModule_AddObject(module, "TVertex", (PyObject *)&TVertex_Type);
|
||||||
|
|
||||||
|
SVertex_mathutils_register_callback();
|
||||||
StrokeVertex_mathutils_register_callback();
|
StrokeVertex_mathutils_register_callback();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------INSTANCE METHODS ----------------------------------
|
/*----------------------Interface1D methods ----------------------------*/
|
||||||
|
|
||||||
static char Interface0D___doc__[] =
|
PyDoc_STRVAR(Interface0D_doc,
|
||||||
"Base class for any 0D element.\n"
|
"Base class for any 0D element.\n"
|
||||||
"\n"
|
"\n"
|
||||||
".. method:: __init__()\n"
|
".. method:: __init__()\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Default constructor.\n";
|
" Default constructor.");
|
||||||
|
|
||||||
static int Interface0D___init__(BPy_Interface0D *self, PyObject *args, PyObject *kwds)
|
static int Interface0D_init(BPy_Interface0D *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
if ( !PyArg_ParseTuple(args, "") )
|
if (!PyArg_ParseTuple(args, ""))
|
||||||
return -1;
|
return -1;
|
||||||
self->if0D = new Interface0D();
|
self->if0D = new Interface0D();
|
||||||
self->borrowed = 0;
|
self->borrowed = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Interface0D___dealloc__(BPy_Interface0D* self)
|
static void Interface0D_dealloc(BPy_Interface0D* self)
|
||||||
{
|
{
|
||||||
if( self->if0D && !self->borrowed )
|
if (self->if0D && !self->borrowed)
|
||||||
delete self->if0D;
|
delete self->if0D;
|
||||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject * Interface0D___repr__(BPy_Interface0D* self)
|
static PyObject * Interface0D_repr(BPy_Interface0D* self)
|
||||||
{
|
{
|
||||||
return PyUnicode_FromFormat("type: %s - address: %p", self->if0D->getExactTypeName().c_str(), self->if0D );
|
return PyUnicode_FromFormat("type: %s - address: %p", self->if0D->getExactTypeName().c_str(), self->if0D);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char Interface0D_getExactTypeName___doc__[] =
|
PyDoc_STRVAR(Interface0D_get_fedge_doc,
|
||||||
".. method:: getExactTypeName()\n"
|
".. method:: get_fedge(inter)\n"
|
||||||
"\n"
|
|
||||||
" Returns the name of the 0D element.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: Name of the interface.\n"
|
|
||||||
" :rtype: str\n";
|
|
||||||
|
|
||||||
static PyObject *Interface0D_getExactTypeName( BPy_Interface0D *self ) {
|
|
||||||
return PyUnicode_FromString( self->if0D->getExactTypeName().c_str() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Interface0D_getX___doc__[] =
|
|
||||||
".. method:: getX()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the X coordinate of the 3D point of the 0D element.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The X coordinate of the 3D point.\n"
|
|
||||||
" :rtype: float\n";
|
|
||||||
|
|
||||||
static PyObject *Interface0D_getX( BPy_Interface0D *self ) {
|
|
||||||
double x = self->if0D->getX();
|
|
||||||
if (PyErr_Occurred())
|
|
||||||
return NULL;
|
|
||||||
return PyFloat_FromDouble( x );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Interface0D_getY___doc__[] =
|
|
||||||
".. method:: getY()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the Y coordinate of the 3D point of the 0D element.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The Y coordinate of the 3D point.\n"
|
|
||||||
" :rtype: float\n";
|
|
||||||
|
|
||||||
static PyObject *Interface0D_getY( BPy_Interface0D *self ) {
|
|
||||||
double y = self->if0D->getY();
|
|
||||||
if (PyErr_Occurred())
|
|
||||||
return NULL;
|
|
||||||
return PyFloat_FromDouble( y );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Interface0D_getZ___doc__[] =
|
|
||||||
".. method:: getZ()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the Z coordinate of the 3D point of the 0D element.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The Z coordinate of the 3D point.\n"
|
|
||||||
" :rtype: float\n";
|
|
||||||
|
|
||||||
static PyObject *Interface0D_getZ( BPy_Interface0D *self ) {
|
|
||||||
double z = self->if0D->getZ();
|
|
||||||
if (PyErr_Occurred())
|
|
||||||
return NULL;
|
|
||||||
return PyFloat_FromDouble( z );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Interface0D_getPoint3D___doc__[] =
|
|
||||||
".. method:: getPoint3D()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the location of the 0D element in the 3D space.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The 3D point of the 0D element.\n"
|
|
||||||
" :rtype: :class:`mathutils.Vector`\n";
|
|
||||||
|
|
||||||
static PyObject *Interface0D_getPoint3D( BPy_Interface0D *self ) {
|
|
||||||
Vec3f v( self->if0D->getPoint3D() );
|
|
||||||
if (PyErr_Occurred())
|
|
||||||
return NULL;
|
|
||||||
return Vector_from_Vec3f( v );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Interface0D_getProjectedX___doc__[] =
|
|
||||||
".. method:: getProjectedX()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the X coordinate of the 2D point of the 0D element.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The X coordinate of the 2D point.\n"
|
|
||||||
" :rtype: float\n";
|
|
||||||
|
|
||||||
static PyObject *Interface0D_getProjectedX( BPy_Interface0D *self ) {
|
|
||||||
double x = self->if0D->getProjectedX();
|
|
||||||
if (PyErr_Occurred())
|
|
||||||
return NULL;
|
|
||||||
return PyFloat_FromDouble( x );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Interface0D_getProjectedY___doc__[] =
|
|
||||||
".. method:: getProjectedY()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the Y coordinate of the 2D point of the 0D element.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The Y coordinate of the 2D point.\n"
|
|
||||||
" :rtype: float\n";
|
|
||||||
|
|
||||||
static PyObject *Interface0D_getProjectedY( BPy_Interface0D *self ) {
|
|
||||||
double y = self->if0D->getProjectedY();
|
|
||||||
if (PyErr_Occurred())
|
|
||||||
return NULL;
|
|
||||||
return PyFloat_FromDouble( y );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Interface0D_getProjectedZ___doc__[] =
|
|
||||||
".. method:: getProjectedZ()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the Z coordinate of the 2D point of the 0D element.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The Z coordinate of the 2D point.\n"
|
|
||||||
" :rtype: float\n";
|
|
||||||
|
|
||||||
static PyObject *Interface0D_getProjectedZ( BPy_Interface0D *self ) {
|
|
||||||
double z = self->if0D->getProjectedZ();
|
|
||||||
if (PyErr_Occurred())
|
|
||||||
return NULL;
|
|
||||||
return PyFloat_FromDouble( z );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Interface0D_getPoint2D___doc__[] =
|
|
||||||
".. method:: getPoint2D()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the location of the 0D element in the 2D space.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The 2D point of the 0D element.\n"
|
|
||||||
" :rtype: :class:`mathutils.Vector`\n";
|
|
||||||
|
|
||||||
static PyObject *Interface0D_getPoint2D( BPy_Interface0D *self ) {
|
|
||||||
Vec2f v( self->if0D->getPoint2D() );
|
|
||||||
if (PyErr_Occurred())
|
|
||||||
return NULL;
|
|
||||||
return Vector_from_Vec2f( v );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Interface0D_getFEdge___doc__[] =
|
|
||||||
".. method:: getFEdge(inter)\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
" Returns the FEdge that lies between this 0D element and the 0D\n"
|
" Returns the FEdge that lies between this 0D element and the 0D\n"
|
||||||
" element given as the argument.\n"
|
" element given as the argument.\n"
|
||||||
@@ -233,68 +102,140 @@ static char Interface0D_getFEdge___doc__[] =
|
|||||||
" :arg inter: A 0D element.\n"
|
" :arg inter: A 0D element.\n"
|
||||||
" :type inter: :class:`Interface0D`\n"
|
" :type inter: :class:`Interface0D`\n"
|
||||||
" :return: The FEdge lying between the two 0D elements.\n"
|
" :return: The FEdge lying between the two 0D elements.\n"
|
||||||
" :rtype: :class:`FEdge`\n";
|
" :rtype: :class:`FEdge`");
|
||||||
|
|
||||||
static PyObject *Interface0D_getFEdge( BPy_Interface0D *self, PyObject *args ) {
|
static PyObject *Interface0D_get_fedge(BPy_Interface0D *self, PyObject *args)
|
||||||
|
{
|
||||||
PyObject *py_if0D;
|
PyObject *py_if0D;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &Interface0D_Type, &py_if0D) ))
|
if (!PyArg_ParseTuple(args, "O!", &Interface0D_Type, &py_if0D))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
FEdge *fe = self->if0D->getFEdge(*(((BPy_Interface0D *)py_if0D)->if0D));
|
||||||
FEdge *fe = self->if0D->getFEdge(*( ((BPy_Interface0D *) py_if0D)->if0D ));
|
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
return NULL;
|
return NULL;
|
||||||
if( fe )
|
if (fe)
|
||||||
return Any_BPy_FEdge_from_FEdge( *fe );
|
return Any_BPy_FEdge_from_FEdge(*fe);
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char Interface0D_getId___doc__[] =
|
static PyMethodDef BPy_Interface0D_methods[] = {
|
||||||
".. method:: getId()\n"
|
{"get_fedge", (PyCFunction)Interface0D_get_fedge, METH_VARARGS, Interface0D_get_fedge_doc},
|
||||||
"\n"
|
{NULL, NULL, 0, NULL}
|
||||||
" Returns the identifier of the 0D element.\n"
|
};
|
||||||
"\n"
|
|
||||||
" :return: The identifier of the 0D element.\n"
|
|
||||||
" :rtype: :class:`Id`\n";
|
|
||||||
|
|
||||||
static PyObject *Interface0D_getId( BPy_Interface0D *self ) {
|
/*----------------------Interface1D get/setters ----------------------------*/
|
||||||
Id id( self->if0D->getId() );
|
|
||||||
if (PyErr_Occurred())
|
PyDoc_STRVAR(Interface0D_exact_type_name_doc,
|
||||||
return NULL;
|
"The string of the the name of this 0D element.\n"
|
||||||
return BPy_Id_from_Id( id );
|
"\n"
|
||||||
|
":type: str");
|
||||||
|
|
||||||
|
static PyObject *Interface0D_exact_type_name_get(BPy_Interface0D *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyUnicode_FromString(self->if0D->getExactTypeName().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
static char Interface0D_getNature___doc__[] =
|
PyDoc_STRVAR(Interface0D_point_3d_doc,
|
||||||
".. method:: getNature()\n"
|
"The 3D point of this 0D element.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Returns the nature of the 0D element.\n"
|
":type: mathutils.Vector");
|
||||||
"\n"
|
|
||||||
" :return: The nature of the 0D element.\n"
|
|
||||||
" :rtype: :class:`Nature`\n";
|
|
||||||
|
|
||||||
static PyObject *Interface0D_getNature( BPy_Interface0D *self ) {
|
static PyObject *Interface0D_point_3d_get(BPy_Interface0D *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
Vec3f p(self->if0D->getPoint3D());
|
||||||
|
if (PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
|
return Vector_from_Vec3f(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Interface0D_projected_x_doc,
|
||||||
|
"The X coordinate of the projected 3D point of this 0D element.\n"
|
||||||
|
"\n"
|
||||||
|
":type: float");
|
||||||
|
|
||||||
|
static PyObject *Interface0D_projected_x_get(BPy_Interface0D *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
real x = self->if0D->getProjectedX();
|
||||||
|
if (PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
|
return PyFloat_FromDouble(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Interface0D_projected_y_doc,
|
||||||
|
"The Y coordinate of the projected 3D point of this 0D element.\n"
|
||||||
|
"\n"
|
||||||
|
":type: float");
|
||||||
|
|
||||||
|
static PyObject *Interface0D_projected_y_get(BPy_Interface0D *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
real y = self->if0D->getProjectedY();
|
||||||
|
if (PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
|
return PyFloat_FromDouble(y);
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Interface0D_projected_z_doc,
|
||||||
|
"The Z coordinate of the projected 3D point of this 0D element.\n"
|
||||||
|
"\n"
|
||||||
|
":type: float");
|
||||||
|
|
||||||
|
static PyObject *Interface0D_projected_z_get(BPy_Interface0D *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
real z = self->if0D->getProjectedZ();
|
||||||
|
if (PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
|
return PyFloat_FromDouble(z);
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Interface0D_point_2d_doc,
|
||||||
|
"The 2D point of this 0D element.\n"
|
||||||
|
"\n"
|
||||||
|
":type: mathutils.Vector");
|
||||||
|
|
||||||
|
static PyObject *Interface0D_point_2d_get(BPy_Interface0D *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
Vec2f p(self->if0D->getPoint2D());
|
||||||
|
if (PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
|
return Vector_from_Vec2f(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Interface0D_id_doc,
|
||||||
|
"The Id of this 0D element.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`Id`");
|
||||||
|
|
||||||
|
static PyObject *Interface0D_id_get(BPy_Interface0D *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
Id id(self->if0D->getId());
|
||||||
|
if (PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
|
return BPy_Id_from_Id(id); // return a copy
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Interface0D_nature_doc,
|
||||||
|
"The nature of this 0D element.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`Nature`");
|
||||||
|
|
||||||
|
static PyObject *Interface0D_nature_get(BPy_Interface0D *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
Nature::VertexNature nature = self->if0D->getNature();
|
Nature::VertexNature nature = self->if0D->getNature();
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
return NULL;
|
return NULL;
|
||||||
return BPy_Nature_from_Nature( nature );
|
return BPy_Nature_from_Nature(nature);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------Interface0D instance definitions ----------------------------*/
|
static PyGetSetDef BPy_Interface0D_getseters[] = {
|
||||||
static PyMethodDef BPy_Interface0D_methods[] = {
|
{(char *)"exact_type_name", (getter)Interface0D_exact_type_name_get, (setter)NULL, (char *)Interface0D_exact_type_name_doc, NULL},
|
||||||
{"getExactTypeName", ( PyCFunction ) Interface0D_getExactTypeName, METH_NOARGS, Interface0D_getExactTypeName___doc__},
|
{(char *)"point_3d", (getter)Interface0D_point_3d_get, (setter)NULL, (char *)Interface0D_point_3d_doc, NULL},
|
||||||
{"getX", ( PyCFunction ) Interface0D_getX, METH_NOARGS, Interface0D_getX___doc__},
|
{(char *)"projected_x", (getter)Interface0D_projected_x_get, (setter)NULL, (char *)Interface0D_projected_x_doc, NULL},
|
||||||
{"getY", ( PyCFunction ) Interface0D_getY, METH_NOARGS, Interface0D_getY___doc__},
|
{(char *)"projected_y", (getter)Interface0D_projected_y_get, (setter)NULL, (char *)Interface0D_projected_y_doc, NULL},
|
||||||
{"getZ", ( PyCFunction ) Interface0D_getZ, METH_NOARGS, Interface0D_getZ___doc__},
|
{(char *)"projected_z", (getter)Interface0D_projected_z_get, (setter)NULL, (char *)Interface0D_projected_z_doc, NULL},
|
||||||
{"getPoint3D", ( PyCFunction ) Interface0D_getPoint3D, METH_NOARGS, Interface0D_getPoint3D___doc__},
|
{(char *)"point_2d", (getter)Interface0D_point_2d_get, (setter)NULL, (char *)Interface0D_point_2d_doc, NULL},
|
||||||
{"getProjectedX", ( PyCFunction ) Interface0D_getProjectedX, METH_NOARGS, Interface0D_getProjectedX___doc__},
|
{(char *)"id", (getter)Interface0D_id_get, (setter)NULL, (char *)Interface0D_id_doc, NULL},
|
||||||
{"getProjectedY", ( PyCFunction ) Interface0D_getProjectedY, METH_NOARGS, Interface0D_getProjectedY___doc__},
|
{(char *)"nature", (getter)Interface0D_nature_get, (setter)NULL, (char *)Interface0D_nature_doc, NULL},
|
||||||
{"getProjectedZ", ( PyCFunction ) Interface0D_getProjectedZ, METH_NOARGS, Interface0D_getProjectedZ___doc__},
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||||
{"getPoint2D", ( PyCFunction ) Interface0D_getPoint2D, METH_NOARGS, Interface0D_getPoint2D___doc__},
|
|
||||||
{"getFEdge", ( PyCFunction ) Interface0D_getFEdge, METH_VARARGS, Interface0D_getFEdge___doc__},
|
|
||||||
{"getId", ( PyCFunction ) Interface0D_getId, METH_NOARGS, Interface0D_getId___doc__},
|
|
||||||
{"getNature", ( PyCFunction ) Interface0D_getNature, METH_NOARGS, Interface0D_getNature___doc__},
|
|
||||||
{NULL, NULL, 0, NULL}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-----------------------BPy_Interface0D type definition ------------------------------*/
|
/*-----------------------BPy_Interface0D type definition ------------------------------*/
|
||||||
@@ -304,12 +245,12 @@ PyTypeObject Interface0D_Type = {
|
|||||||
"Interface0D", /* tp_name */
|
"Interface0D", /* tp_name */
|
||||||
sizeof(BPy_Interface0D), /* tp_basicsize */
|
sizeof(BPy_Interface0D), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)Interface0D___dealloc__, /* tp_dealloc */
|
(destructor)Interface0D_dealloc, /* tp_dealloc */
|
||||||
0, /* tp_print */
|
0, /* tp_print */
|
||||||
0, /* tp_getattr */
|
0, /* tp_getattr */
|
||||||
0, /* tp_setattr */
|
0, /* tp_setattr */
|
||||||
0, /* tp_reserved */
|
0, /* tp_reserved */
|
||||||
(reprfunc)Interface0D___repr__, /* tp_repr */
|
(reprfunc)Interface0D_repr, /* tp_repr */
|
||||||
0, /* tp_as_number */
|
0, /* tp_as_number */
|
||||||
0, /* tp_as_sequence */
|
0, /* tp_as_sequence */
|
||||||
0, /* tp_as_mapping */
|
0, /* tp_as_mapping */
|
||||||
@@ -320,7 +261,7 @@ PyTypeObject Interface0D_Type = {
|
|||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
Interface0D___doc__, /* tp_doc */
|
Interface0D_doc, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
@@ -329,23 +270,15 @@ PyTypeObject Interface0D_Type = {
|
|||||||
0, /* tp_iternext */
|
0, /* tp_iternext */
|
||||||
BPy_Interface0D_methods, /* tp_methods */
|
BPy_Interface0D_methods, /* tp_methods */
|
||||||
0, /* tp_members */
|
0, /* tp_members */
|
||||||
0, /* tp_getset */
|
BPy_Interface0D_getseters, /* tp_getset */
|
||||||
0, /* tp_base */
|
0, /* tp_base */
|
||||||
0, /* tp_dict */
|
0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
(initproc)Interface0D___init__, /* tp_init */
|
(initproc)Interface0D_init, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
PyType_GenericNew, /* tp_new */
|
PyType_GenericNew, /* tp_new */
|
||||||
0, /* tp_free */
|
|
||||||
0, /* tp_is_gc */
|
|
||||||
0, /* tp_bases */
|
|
||||||
0, /* tp_mro */
|
|
||||||
0, /* tp_cache */
|
|
||||||
0, /* tp_subclasses */
|
|
||||||
0, /* tp_weaklist */
|
|
||||||
0 /* tp_del */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -353,4 +286,3 @@ PyTypeObject Interface0D_Type = {
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -18,211 +18,126 @@ extern "C" {
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//-------------------MODULE INITIALIZATION--------------------------------
|
//-------------------MODULE INITIALIZATION--------------------------------
|
||||||
int Interface1D_Init( PyObject *module )
|
int Interface1D_Init(PyObject *module)
|
||||||
{
|
{
|
||||||
if( module == NULL )
|
if (module == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( PyType_Ready( &Interface1D_Type ) < 0 )
|
if (PyType_Ready(&Interface1D_Type) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
Py_INCREF( &Interface1D_Type );
|
Py_INCREF(&Interface1D_Type);
|
||||||
PyModule_AddObject(module, "Interface1D", (PyObject *)&Interface1D_Type);
|
PyModule_AddObject(module, "Interface1D", (PyObject *)&Interface1D_Type);
|
||||||
|
|
||||||
if( PyType_Ready( &FrsCurve_Type ) < 0 )
|
if (PyType_Ready(&FrsCurve_Type) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
Py_INCREF( &FrsCurve_Type );
|
Py_INCREF(&FrsCurve_Type);
|
||||||
PyModule_AddObject(module, "Curve", (PyObject *)&FrsCurve_Type);
|
PyModule_AddObject(module, "Curve", (PyObject *)&FrsCurve_Type);
|
||||||
|
|
||||||
if( PyType_Ready( &Chain_Type ) < 0 )
|
if (PyType_Ready(&Chain_Type) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
Py_INCREF( &Chain_Type );
|
Py_INCREF(&Chain_Type);
|
||||||
PyModule_AddObject(module, "Chain", (PyObject *)&Chain_Type);
|
PyModule_AddObject(module, "Chain", (PyObject *)&Chain_Type);
|
||||||
|
|
||||||
if( PyType_Ready( &FEdge_Type ) < 0 )
|
if (PyType_Ready(&FEdge_Type) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
Py_INCREF( &FEdge_Type );
|
Py_INCREF(&FEdge_Type);
|
||||||
PyModule_AddObject(module, "FEdge", (PyObject *)&FEdge_Type);
|
PyModule_AddObject(module, "FEdge", (PyObject *)&FEdge_Type);
|
||||||
|
|
||||||
if( PyType_Ready( &FEdgeSharp_Type ) < 0 )
|
if (PyType_Ready(&FEdgeSharp_Type) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
Py_INCREF( &FEdgeSharp_Type );
|
Py_INCREF(&FEdgeSharp_Type);
|
||||||
PyModule_AddObject(module, "FEdgeSharp", (PyObject *)&FEdgeSharp_Type);
|
PyModule_AddObject(module, "FEdgeSharp", (PyObject *)&FEdgeSharp_Type);
|
||||||
|
|
||||||
if( PyType_Ready( &FEdgeSmooth_Type ) < 0 )
|
if (PyType_Ready(&FEdgeSmooth_Type) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
Py_INCREF( &FEdgeSmooth_Type );
|
Py_INCREF(&FEdgeSmooth_Type);
|
||||||
PyModule_AddObject(module, "FEdgeSmooth", (PyObject *)&FEdgeSmooth_Type);
|
PyModule_AddObject(module, "FEdgeSmooth", (PyObject *)&FEdgeSmooth_Type);
|
||||||
|
|
||||||
if( PyType_Ready( &Stroke_Type ) < 0 )
|
if (PyType_Ready(&Stroke_Type) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
Py_INCREF( &Stroke_Type );
|
Py_INCREF(&Stroke_Type);
|
||||||
PyModule_AddObject(module, "Stroke", (PyObject *)&Stroke_Type);
|
PyModule_AddObject(module, "Stroke", (PyObject *)&Stroke_Type);
|
||||||
|
|
||||||
PyDict_SetItemString( Stroke_Type.tp_dict, "DRY_MEDIUM", BPy_MediumType_DRY_MEDIUM );
|
PyDict_SetItemString(Stroke_Type.tp_dict, "DRY_MEDIUM", BPy_MediumType_DRY_MEDIUM);
|
||||||
PyDict_SetItemString( Stroke_Type.tp_dict, "HUMID_MEDIUM", BPy_MediumType_HUMID_MEDIUM );
|
PyDict_SetItemString(Stroke_Type.tp_dict, "HUMID_MEDIUM", BPy_MediumType_HUMID_MEDIUM);
|
||||||
PyDict_SetItemString( Stroke_Type.tp_dict, "OPAQUE_MEDIUM", BPy_MediumType_OPAQUE_MEDIUM );
|
PyDict_SetItemString(Stroke_Type.tp_dict, "OPAQUE_MEDIUM", BPy_MediumType_OPAQUE_MEDIUM);
|
||||||
|
|
||||||
if( PyType_Ready( &ViewEdge_Type ) < 0 )
|
if (PyType_Ready(&ViewEdge_Type) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
Py_INCREF( &ViewEdge_Type );
|
Py_INCREF(&ViewEdge_Type);
|
||||||
PyModule_AddObject(module, "ViewEdge", (PyObject *)&ViewEdge_Type);
|
PyModule_AddObject(module, "ViewEdge", (PyObject *)&ViewEdge_Type);
|
||||||
|
|
||||||
|
FEdgeSharp_mathutils_register_callback();
|
||||||
|
FEdgeSmooth_mathutils_register_callback();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------INSTANCE METHODS ----------------------------------
|
/*----------------------Interface1D methods ----------------------------*/
|
||||||
|
|
||||||
static char Interface1D___doc__[] =
|
PyDoc_STRVAR(Interface1D_doc,
|
||||||
"Base class for any 1D element.\n"
|
"Base class for any 1D element.\n"
|
||||||
"\n"
|
"\n"
|
||||||
".. method:: __init__()\n"
|
".. method:: __init__()\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Default constructor.\n";
|
" Default constructor.");
|
||||||
|
|
||||||
static int Interface1D___init__(BPy_Interface1D *self, PyObject *args, PyObject *kwds)
|
static int Interface1D_init(BPy_Interface1D *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
if ( !PyArg_ParseTuple(args, "") )
|
if (!PyArg_ParseTuple(args, ""))
|
||||||
return -1;
|
return -1;
|
||||||
self->if1D = new Interface1D();
|
self->if1D = new Interface1D();
|
||||||
self->borrowed = 0;
|
self->borrowed = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Interface1D___dealloc__(BPy_Interface1D* self)
|
static void Interface1D_dealloc(BPy_Interface1D* self)
|
||||||
{
|
{
|
||||||
if( self->if1D && !self->borrowed )
|
if (self->if1D && !self->borrowed)
|
||||||
delete self->if1D;
|
delete self->if1D;
|
||||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject * Interface1D___repr__(BPy_Interface1D* self)
|
static PyObject * Interface1D_repr(BPy_Interface1D* self)
|
||||||
{
|
{
|
||||||
return PyUnicode_FromFormat("type: %s - address: %p", self->if1D->getExactTypeName().c_str(), self->if1D );
|
return PyUnicode_FromFormat("type: %s - address: %p", self->if1D->getExactTypeName().c_str(), self->if1D);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char Interface1D_getExactTypeName___doc__[] =
|
PyDoc_STRVAR(Interface1D_vertices_begin_doc,
|
||||||
".. method:: getExactTypeName()\n"
|
".. method:: vertices_begin()\n"
|
||||||
"\n"
|
|
||||||
" Returns the string of the name of the 1D element.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The name of the 1D element.\n"
|
|
||||||
" :rtype: str\n";
|
|
||||||
|
|
||||||
static PyObject *Interface1D_getExactTypeName( BPy_Interface1D *self ) {
|
|
||||||
return PyUnicode_FromString( self->if1D->getExactTypeName().c_str() );
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static PyObject *Interface1D_getVertices( BPy_Interface1D *self ) {
|
|
||||||
return PyList_New(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject *Interface1D_getPoints( BPy_Interface1D *self ) {
|
|
||||||
return PyList_New(0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static char Interface1D_getLength2D___doc__[] =
|
|
||||||
".. method:: getLength2D()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the 2D length of the 1D element.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The 2D length of the 1D element.\n"
|
|
||||||
" :rtype: float\n";
|
|
||||||
|
|
||||||
static PyObject *Interface1D_getLength2D( BPy_Interface1D *self ) {
|
|
||||||
return PyFloat_FromDouble( (double) self->if1D->getLength2D() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Interface1D_getId___doc__[] =
|
|
||||||
".. method:: getId()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the Id of the 1D element .\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The Id of the 1D element .\n"
|
|
||||||
" :rtype: :class:`Id`\n";
|
|
||||||
|
|
||||||
static PyObject *Interface1D_getId( BPy_Interface1D *self ) {
|
|
||||||
Id id( self->if1D->getId() );
|
|
||||||
return BPy_Id_from_Id( id );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Interface1D_getNature___doc__[] =
|
|
||||||
".. method:: getNature()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the nature of the 1D element.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The nature of the 1D element.\n"
|
|
||||||
" :rtype: :class:`Nature`\n";
|
|
||||||
|
|
||||||
static PyObject *Interface1D_getNature( BPy_Interface1D *self ) {
|
|
||||||
return BPy_Nature_from_Nature( self->if1D->getNature() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Interface1D_getTimeStamp___doc__[] =
|
|
||||||
".. method:: getTimeStamp()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the time stamp of the 1D element. Mainly used for selection.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The time stamp of the 1D element.\n"
|
|
||||||
" :rtype: int\n";
|
|
||||||
|
|
||||||
static PyObject *Interface1D_getTimeStamp( BPy_Interface1D *self ) {
|
|
||||||
return PyLong_FromLong( self->if1D->getTimeStamp() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Interface1D_setTimeStamp___doc__[] =
|
|
||||||
".. method:: setTimeStamp(iTimeStamp)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the time stamp for the 1D element.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iTimeStamp: A time stamp.\n"
|
|
||||||
" :type iTimeStamp: int\n";
|
|
||||||
|
|
||||||
static PyObject *Interface1D_setTimeStamp( BPy_Interface1D *self, PyObject *args) {
|
|
||||||
int timestamp = 0 ;
|
|
||||||
|
|
||||||
if( !PyArg_ParseTuple(args, "i", ×tamp) )
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->if1D->setTimeStamp( timestamp );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Interface1D_verticesBegin___doc__[] =
|
|
||||||
".. method:: verticesBegin()\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
" Returns an iterator over the Interface1D vertices, pointing to the\n"
|
" Returns an iterator over the Interface1D vertices, pointing to the\n"
|
||||||
" first vertex.\n"
|
" first vertex.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :return: An Interface0DIterator pointing to the first vertex.\n"
|
" :return: An Interface0DIterator pointing to the first vertex.\n"
|
||||||
" :rtype: :class:`Interface0DIterator`\n";
|
" :rtype: :class:`Interface0DIterator`");
|
||||||
|
|
||||||
static PyObject * Interface1D_verticesBegin( BPy_Interface1D *self ) {
|
static PyObject * Interface1D_vertices_begin(BPy_Interface1D *self)
|
||||||
Interface0DIterator if0D_it( self->if1D->verticesBegin() );
|
{
|
||||||
return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it, 0 );
|
Interface0DIterator if0D_it(self->if1D->verticesBegin());
|
||||||
|
return BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char Interface1D_verticesEnd___doc__[] =
|
PyDoc_STRVAR(Interface1D_vertices_end_doc,
|
||||||
".. method:: verticesEnd()\n"
|
".. method:: vertices_end()\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Returns an iterator over the Interface1D vertices, pointing after\n"
|
" Returns an iterator over the Interface1D vertices, pointing after\n"
|
||||||
" the last vertex.\n"
|
" the last vertex.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :return: An Interface0DIterator pointing after the last vertex.\n"
|
" :return: An Interface0DIterator pointing after the last vertex.\n"
|
||||||
" :rtype: :class:`Interface0DIterator`\n";
|
" :rtype: :class:`Interface0DIterator`");
|
||||||
|
|
||||||
static PyObject * Interface1D_verticesEnd( BPy_Interface1D *self ) {
|
static PyObject * Interface1D_vertices_end(BPy_Interface1D *self)
|
||||||
Interface0DIterator if0D_it( self->if1D->verticesEnd() );
|
{
|
||||||
return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it, 1 );
|
Interface0DIterator if0D_it(self->if1D->verticesEnd());
|
||||||
|
return BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char Interface1D_pointsBegin___doc__[] =
|
PyDoc_STRVAR(Interface1D_points_begin_doc,
|
||||||
".. method:: pointsBegin(t=0.0)\n"
|
".. method:: points_begin(t=0.0)\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Returns an iterator over the Interface1D points, pointing to the\n"
|
" Returns an iterator over the Interface1D points, pointing to the\n"
|
||||||
" first point. The difference with verticesBegin() is that here we can\n"
|
" first point. The difference with vertices_begin() is that here we can\n"
|
||||||
" iterate over points of the 1D element at a any given sampling.\n"
|
" iterate over points of the 1D element at a any given sampling.\n"
|
||||||
" Indeed, for each iteration, a virtual point is created.\n"
|
" Indeed, for each iteration, a virtual point is created.\n"
|
||||||
"\n"
|
"\n"
|
||||||
@@ -230,23 +145,23 @@ static char Interface1D_pointsBegin___doc__[] =
|
|||||||
" this 1D element.\n"
|
" this 1D element.\n"
|
||||||
" :type t: float\n"
|
" :type t: float\n"
|
||||||
" :return: An Interface0DIterator pointing to the first point.\n"
|
" :return: An Interface0DIterator pointing to the first point.\n"
|
||||||
" :rtype: :class:`Interface0DIterator`\n";
|
" :rtype: :class:`Interface0DIterator`");
|
||||||
|
|
||||||
static PyObject * Interface1D_pointsBegin( BPy_Interface1D *self, PyObject *args ) {
|
static PyObject * Interface1D_points_begin(BPy_Interface1D *self, PyObject *args)
|
||||||
|
{
|
||||||
float f = 0;
|
float f = 0;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "|f", &f) ))
|
if(!(PyArg_ParseTuple(args, "|f", &f)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Interface0DIterator if0D_it(self->if1D->pointsBegin(f));
|
||||||
Interface0DIterator if0D_it( self->if1D->pointsBegin(f) );
|
return BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, 0);
|
||||||
return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it, 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char Interface1D_pointsEnd___doc__[] =
|
PyDoc_STRVAR(Interface1D_points_end_doc,
|
||||||
".. method:: pointsEnd(t=0.0)\n"
|
".. method:: points_end(t=0.0)\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Returns an iterator over the Interface1D points, pointing after the\n"
|
" Returns an iterator over the Interface1D points, pointing after the\n"
|
||||||
" last point. The difference with verticesEnd() is that here we can\n"
|
" last point. The difference with vertices_end() is that here we can\n"
|
||||||
" iterate over points of the 1D element at a given sampling. Indeed,\n"
|
" iterate over points of the 1D element at a given sampling. Indeed,\n"
|
||||||
" for each iteration, a virtual point is created.\n"
|
" for each iteration, a virtual point is created.\n"
|
||||||
"\n"
|
"\n"
|
||||||
@@ -254,37 +169,108 @@ static char Interface1D_pointsEnd___doc__[] =
|
|||||||
" this 1D element.\n"
|
" this 1D element.\n"
|
||||||
" :type t: float\n"
|
" :type t: float\n"
|
||||||
" :return: An Interface0DIterator pointing after the last point.\n"
|
" :return: An Interface0DIterator pointing after the last point.\n"
|
||||||
" :rtype: :class:`Interface0DIterator`\n";
|
" :rtype: :class:`Interface0DIterator`");
|
||||||
|
|
||||||
static PyObject * Interface1D_pointsEnd( BPy_Interface1D *self, PyObject *args ) {
|
static PyObject * Interface1D_points_end(BPy_Interface1D *self, PyObject *args)
|
||||||
|
{
|
||||||
float f = 0;
|
float f = 0;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "|f", &f) ))
|
if (!PyArg_ParseTuple(args, "|f", &f))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Interface0DIterator if0D_it(self->if1D->pointsEnd(f));
|
||||||
Interface0DIterator if0D_it( self->if1D->pointsEnd(f) );
|
return BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, 1);
|
||||||
return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it, 1 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------Interface1D instance definitions ----------------------------*/
|
|
||||||
static PyMethodDef BPy_Interface1D_methods[] = {
|
static PyMethodDef BPy_Interface1D_methods[] = {
|
||||||
{"getExactTypeName", ( PyCFunction ) Interface1D_getExactTypeName, METH_NOARGS, Interface1D_getExactTypeName___doc__},
|
{"vertices_begin", (PyCFunction)Interface1D_vertices_begin, METH_NOARGS, Interface1D_vertices_begin_doc},
|
||||||
#if 0
|
{"vertices_end", (PyCFunction)Interface1D_vertices_end, METH_NOARGS, Interface1D_vertices_end_doc},
|
||||||
{"getVertices", ( PyCFunction ) Interface1D_getVertices, METH_NOARGS, "Returns the vertices"},
|
{"points_begin", (PyCFunction)Interface1D_points_begin, METH_VARARGS, Interface1D_points_begin_doc},
|
||||||
{"getPoints", ( PyCFunction ) Interface1D_getPoints, METH_NOARGS, "Returns the points. The difference with getVertices() is that here we can iterate over points of the 1D element at any given sampling. At each call, a virtual point is created."},
|
{"points_end", (PyCFunction)Interface1D_points_end, METH_VARARGS, Interface1D_points_end_doc},
|
||||||
#endif
|
|
||||||
{"getLength2D", ( PyCFunction ) Interface1D_getLength2D, METH_NOARGS, Interface1D_getLength2D___doc__},
|
|
||||||
{"getId", ( PyCFunction ) Interface1D_getId, METH_NOARGS, Interface1D_getId___doc__},
|
|
||||||
{"getNature", ( PyCFunction ) Interface1D_getNature, METH_NOARGS, Interface1D_getNature___doc__},
|
|
||||||
{"getTimeStamp", ( PyCFunction ) Interface1D_getTimeStamp, METH_NOARGS, Interface1D_getTimeStamp___doc__},
|
|
||||||
{"setTimeStamp", ( PyCFunction ) Interface1D_setTimeStamp, METH_VARARGS, Interface1D_setTimeStamp___doc__},
|
|
||||||
{"verticesBegin", ( PyCFunction ) Interface1D_verticesBegin, METH_NOARGS, Interface1D_verticesBegin___doc__},
|
|
||||||
{"verticesEnd", ( PyCFunction ) Interface1D_verticesEnd, METH_NOARGS, Interface1D_verticesEnd___doc__},
|
|
||||||
{"pointsBegin", ( PyCFunction ) Interface1D_pointsBegin, METH_VARARGS, Interface1D_pointsBegin___doc__},
|
|
||||||
{"pointsEnd", ( PyCFunction ) Interface1D_pointsEnd, METH_VARARGS, Interface1D_pointsEnd___doc__},
|
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*----------------------Interface1D get/setters ----------------------------*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Interface1D_exact_type_name_doc,
|
||||||
|
"The string of the name of the 1D element.\n"
|
||||||
|
"\n"
|
||||||
|
":type: str");
|
||||||
|
|
||||||
|
static PyObject *Interface1D_exact_type_name_get(BPy_Interface1D *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyUnicode_FromString(self->if1D->getExactTypeName().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Interface1D_id_doc,
|
||||||
|
"The Id of this Interface1D.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`Id`");
|
||||||
|
|
||||||
|
static PyObject *Interface1D_id_get(BPy_Interface1D *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
Id id(self->if1D->getId());
|
||||||
|
if (PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
|
return BPy_Id_from_Id(id); // return a copy
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Interface1D_nature_doc,
|
||||||
|
"The nature of this Interface1D.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`Nature`");
|
||||||
|
|
||||||
|
static PyObject *Interface1D_nature_get(BPy_Interface1D *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
Nature::VertexNature nature = self->if1D->getNature();
|
||||||
|
if (PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
|
return BPy_Nature_from_Nature(nature);
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Interface1D_length_2d_doc,
|
||||||
|
"The 2D length of this Interface1D.\n"
|
||||||
|
"\n"
|
||||||
|
":type: float");
|
||||||
|
|
||||||
|
static PyObject *Interface1D_length_2d_get(BPy_Interface1D *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
real length = self->if1D->getLength2D();
|
||||||
|
if (PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
|
return PyFloat_FromDouble((double)length);
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Interface1D_time_stamp_doc,
|
||||||
|
"The time stamp of the 1D element, mainly used for selection.\n"
|
||||||
|
"\n"
|
||||||
|
":type: int");
|
||||||
|
|
||||||
|
static PyObject *Interface1D_time_stamp_get(BPy_Interface1D *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyLong_FromLong(self->if1D->getTimeStamp());
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Interface1D_time_stamp_set(BPy_Interface1D *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
int timestamp;
|
||||||
|
|
||||||
|
if ((timestamp = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be a number");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->if1D->setTimeStamp(timestamp);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyGetSetDef BPy_Interface1D_getseters[] = {
|
||||||
|
{(char *)"exact_type_name", (getter)Interface1D_exact_type_name_get, (setter)NULL, (char *)Interface1D_exact_type_name_doc, NULL},
|
||||||
|
{(char *)"id", (getter)Interface1D_id_get, (setter)NULL, (char *)Interface1D_id_doc, NULL},
|
||||||
|
{(char *)"nature", (getter)Interface1D_nature_get, (setter)NULL, (char *)Interface1D_nature_doc, NULL},
|
||||||
|
{(char *)"length_2d", (getter)Interface1D_length_2d_get, (setter)NULL, (char *)Interface1D_length_2d_doc, NULL},
|
||||||
|
{(char *)"time_stamp", (getter)Interface1D_time_stamp_get, (setter)Interface1D_time_stamp_set, (char *)Interface1D_time_stamp_doc, NULL},
|
||||||
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||||
|
};
|
||||||
|
|
||||||
/*-----------------------BPy_Interface1D type definition ------------------------------*/
|
/*-----------------------BPy_Interface1D type definition ------------------------------*/
|
||||||
|
|
||||||
PyTypeObject Interface1D_Type = {
|
PyTypeObject Interface1D_Type = {
|
||||||
@@ -292,12 +278,12 @@ PyTypeObject Interface1D_Type = {
|
|||||||
"Interface1D", /* tp_name */
|
"Interface1D", /* tp_name */
|
||||||
sizeof(BPy_Interface1D), /* tp_basicsize */
|
sizeof(BPy_Interface1D), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)Interface1D___dealloc__, /* tp_dealloc */
|
(destructor)Interface1D_dealloc, /* tp_dealloc */
|
||||||
0, /* tp_print */
|
0, /* tp_print */
|
||||||
0, /* tp_getattr */
|
0, /* tp_getattr */
|
||||||
0, /* tp_setattr */
|
0, /* tp_setattr */
|
||||||
0, /* tp_reserved */
|
0, /* tp_reserved */
|
||||||
(reprfunc)Interface1D___repr__, /* tp_repr */
|
(reprfunc)Interface1D_repr, /* tp_repr */
|
||||||
0, /* tp_as_number */
|
0, /* tp_as_number */
|
||||||
0, /* tp_as_sequence */
|
0, /* tp_as_sequence */
|
||||||
0, /* tp_as_mapping */
|
0, /* tp_as_mapping */
|
||||||
@@ -308,7 +294,7 @@ PyTypeObject Interface1D_Type = {
|
|||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
Interface1D___doc__, /* tp_doc */
|
Interface1D_doc, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
@@ -317,13 +303,13 @@ PyTypeObject Interface1D_Type = {
|
|||||||
0, /* tp_iternext */
|
0, /* tp_iternext */
|
||||||
BPy_Interface1D_methods, /* tp_methods */
|
BPy_Interface1D_methods, /* tp_methods */
|
||||||
0, /* tp_members */
|
0, /* tp_members */
|
||||||
0, /* tp_getset */
|
BPy_Interface1D_getseters, /* tp_getset */
|
||||||
0, /* tp_base */
|
0, /* tp_base */
|
||||||
0, /* tp_dict */
|
0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
(initproc)Interface1D___init__, /* tp_init */
|
(initproc)Interface1D_init, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
PyType_GenericNew, /* tp_new */
|
PyType_GenericNew, /* tp_new */
|
||||||
};
|
};
|
||||||
@@ -333,5 +319,3 @@ PyTypeObject Interface1D_Type = {
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,22 +13,22 @@ extern "C" {
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//-------------------MODULE INITIALIZATION--------------------------------
|
//-------------------MODULE INITIALIZATION--------------------------------
|
||||||
int SShape_Init( PyObject *module )
|
int SShape_Init(PyObject *module)
|
||||||
{
|
{
|
||||||
if( module == NULL )
|
if (module == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( PyType_Ready( &SShape_Type ) < 0 )
|
if (PyType_Ready(&SShape_Type) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
Py_INCREF( &SShape_Type );
|
Py_INCREF( &SShape_Type );
|
||||||
PyModule_AddObject(module, "SShape", (PyObject *)&SShape_Type);
|
PyModule_AddObject(module, "SShape", (PyObject *)&SShape_Type);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------INSTANCE METHODS ----------------------------------
|
/*----------------------SShape methods ----------------------------*/
|
||||||
|
|
||||||
static char SShape___doc__[] =
|
PyDoc_STRVAR(SShape_doc,
|
||||||
"Class to define a feature shape. It is the gathering of feature\n"
|
"Class to define a feature shape. It is the gathering of feature\n"
|
||||||
"elements from an identified input shape.\n"
|
"elements from an identified input shape.\n"
|
||||||
"\n"
|
"\n"
|
||||||
@@ -41,222 +41,82 @@ static char SShape___doc__[] =
|
|||||||
" Copy constructor.\n"
|
" Copy constructor.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg iBrother: An SShape object.\n"
|
" :arg iBrother: An SShape object.\n"
|
||||||
" :type iBrother: :class:`SShape`\n";
|
" :type iBrother: :class:`SShape`");
|
||||||
|
|
||||||
static int SShape___init__(BPy_SShape *self, PyObject *args, PyObject *kwds)
|
static int SShape_init(BPy_SShape *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyObject *obj = NULL;
|
PyObject *obj = NULL;
|
||||||
|
|
||||||
if (! PyArg_ParseTuple(args, "|O!", &SShape_Type, &obj) )
|
if (!PyArg_ParseTuple(args, "|O!", &SShape_Type, &obj))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( !obj ) {
|
if (!obj) {
|
||||||
self->ss = new SShape();
|
self->ss = new SShape();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
self->ss = new SShape(*( ((BPy_SShape *) obj)->ss ));
|
self->ss = new SShape(*(((BPy_SShape *)obj)->ss));
|
||||||
}
|
}
|
||||||
self->borrowed = 0;
|
self->borrowed = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SShape___dealloc__(BPy_SShape *self)
|
static void SShape_dealloc(BPy_SShape *self)
|
||||||
{
|
{
|
||||||
if( self->ss && !self->borrowed )
|
if (self->ss && !self->borrowed)
|
||||||
delete self->ss;
|
delete self->ss;
|
||||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject * SShape___repr__(BPy_SShape *self)
|
static PyObject * SShape_repr(BPy_SShape *self)
|
||||||
{
|
{
|
||||||
return PyUnicode_FromFormat("SShape - address: %p", self->ss );
|
return PyUnicode_FromFormat("SShape - address: %p", self->ss);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char SShape_AddEdge___doc__[] =
|
static char SShape_add_edge_doc[] =
|
||||||
".. method:: AddEdge(iEdge)\n"
|
".. method:: add_edge(iEdge)\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Adds an FEdge to the list of FEdges.\n"
|
" Adds an FEdge to the list of FEdges.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg iEdge: An FEdge object.\n"
|
" :arg iEdge: An FEdge object.\n"
|
||||||
" :type iEdge: :class:`FEdge`\n";
|
" :type iEdge: :class:`FEdge`\n";
|
||||||
|
|
||||||
static PyObject * SShape_AddEdge( BPy_SShape *self , PyObject *args) {
|
static PyObject * SShape_add_edge(BPy_SShape *self , PyObject *args)
|
||||||
|
{
|
||||||
PyObject *py_fe = 0;
|
PyObject *py_fe = 0;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe) ))
|
if (!PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
self->ss->AddEdge(((BPy_FEdge *)py_fe)->fe);
|
||||||
self->ss->AddEdge( ((BPy_FEdge *) py_fe)->fe );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char SShape_AddNewVertex___doc__[] =
|
PyDoc_STRVAR(SShape_add_vertex_doc,
|
||||||
".. method:: AddNewVertex(iv)\n"
|
".. method:: add_vertex(iv)\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Adds an SVertex to the list of SVertex of this Shape. The SShape\n"
|
" Adds an SVertex to the list of SVertex of this Shape. The SShape\n"
|
||||||
" attribute of the SVertex is also set to this SShape.\n"
|
" attribute of the SVertex is also set to this SShape.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg iv: An SVertex object.\n"
|
" :arg iv: An SVertex object.\n"
|
||||||
" :type iv: :class:`SVertex`\n";
|
" :type iv: :class:`SVertex`");
|
||||||
|
|
||||||
static PyObject * SShape_AddNewVertex( BPy_SShape *self , PyObject *args) {
|
static PyObject * SShape_add_vertex(BPy_SShape *self , PyObject *args)
|
||||||
|
{
|
||||||
PyObject *py_sv = 0;
|
PyObject *py_sv = 0;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &SVertex_Type, &py_sv) ))
|
if (!PyArg_ParseTuple(args, "O!", &SVertex_Type, &py_sv))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
self->ss->AddNewVertex(((BPy_SVertex *)py_sv)->sv);
|
||||||
self->ss->AddNewVertex( ((BPy_SVertex *) py_sv)->sv );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char SShape_setBBox___doc__[] =
|
PyDoc_STRVAR(SShape_compute_bbox_doc,
|
||||||
".. method:: setBBox(iBBox)\n"
|
".. method:: compute_bbox()\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Sets the bounding box of the SShape.\n"
|
" Compute the bbox of the SShape.");
|
||||||
"\n"
|
|
||||||
" :arg iBBox: The bounding box of the SShape.\n"
|
|
||||||
" :type iBBox: :class:`BBox`\n";
|
|
||||||
|
|
||||||
static PyObject * SShape_setBBox( BPy_SShape *self , PyObject *args) {
|
static PyObject * SShape_compute_bbox(BPy_SShape *self)
|
||||||
PyObject *py_bb = 0;
|
{
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &BBox_Type, &py_bb) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->ss->setBBox(*( ((BPy_BBox*) py_bb)->bb ));
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char SShape_ComputeBBox___doc__[] =
|
|
||||||
".. method:: ComputeBBox()\n"
|
|
||||||
"\n"
|
|
||||||
" Compute the bbox of the SShape.\n";
|
|
||||||
|
|
||||||
static PyObject * SShape_ComputeBBox( BPy_SShape *self ) {
|
|
||||||
self->ss->ComputeBBox();
|
self->ss->ComputeBBox();
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char SShape_bbox___doc__[] =
|
|
||||||
".. method:: bbox()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the bounding box of the SShape.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: the bounding box of the SShape.\n"
|
|
||||||
" :rtype: :class:`BBox`\n";
|
|
||||||
|
|
||||||
static PyObject * SShape_bbox( BPy_SShape *self ) {
|
|
||||||
BBox<Vec3r> bb( self->ss->bbox() );
|
|
||||||
return BPy_BBox_from_BBox( bb );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char SShape_getVertexList___doc__[] =
|
|
||||||
".. method:: getVertexList()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the list of vertices of the SShape.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The list of vertices objects.\n"
|
|
||||||
" :rtype: List of :class:`SVertex` objects\n";
|
|
||||||
|
|
||||||
static PyObject * SShape_getVertexList( BPy_SShape *self ) {
|
|
||||||
PyObject *py_vertices = PyList_New(0);
|
|
||||||
|
|
||||||
vector< SVertex * > vertices = self->ss->getVertexList();
|
|
||||||
vector< SVertex * >::iterator it;
|
|
||||||
|
|
||||||
for( it = vertices.begin(); it != vertices.end(); it++ ) {
|
|
||||||
PyList_Append( py_vertices, BPy_SVertex_from_SVertex(*( *it )) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return py_vertices;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char SShape_getEdgeList___doc__[] =
|
|
||||||
".. method:: getEdgeList()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the list of edges of the SShape.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The list of edges of the SShape.\n"
|
|
||||||
" :rtype: List of :class:`FEdge` objects\n";
|
|
||||||
|
|
||||||
static PyObject * SShape_getEdgeList( BPy_SShape *self ) {
|
|
||||||
PyObject *py_edges = PyList_New(0);
|
|
||||||
|
|
||||||
vector< FEdge * > edges = self->ss->getEdgeList();
|
|
||||||
vector< FEdge * >::iterator it;
|
|
||||||
|
|
||||||
for( it = edges.begin(); it != edges.end(); it++ ) {
|
|
||||||
PyList_Append( py_edges, Any_BPy_FEdge_from_FEdge(*( *it )) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return py_edges;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char SShape_getId___doc__[] =
|
|
||||||
".. method:: getId()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the Id of the SShape.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The Id of the SShape.\n"
|
|
||||||
" :rtype: :class:`Id`\n";
|
|
||||||
|
|
||||||
static PyObject * SShape_getId( BPy_SShape *self ) {
|
|
||||||
Id id( self->ss->getId() );
|
|
||||||
return BPy_Id_from_Id( id );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char SShape_setId___doc__[] =
|
|
||||||
".. method:: setId(id)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the Id of the SShape.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg id: The Id of the SShape.\n"
|
|
||||||
" :type id: :class:`Id`\n";
|
|
||||||
|
|
||||||
static PyObject * SShape_setId( BPy_SShape *self , PyObject *args) {
|
|
||||||
PyObject *py_id;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &Id_Type, &py_id) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->ss->setId(*( ((BPy_Id *) py_id)->id ));
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char SShape_getName___doc__[] =
|
|
||||||
".. method:: getName()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the name of the SShape.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The name string.\n"
|
|
||||||
" :rtype: str\n";
|
|
||||||
|
|
||||||
static PyObject * SShape_getName( BPy_SShape *self ) {
|
|
||||||
return PyUnicode_FromString( self->ss->getName().c_str() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char SShape_setName___doc__[] =
|
|
||||||
".. method:: setName(name)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the name of the SShape.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg name: A name string.\n"
|
|
||||||
" :type name: str\n";
|
|
||||||
|
|
||||||
static PyObject * SShape_setName( BPy_SShape *self , PyObject *args) {
|
|
||||||
char *s;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "s", &s) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->ss->setName(s);
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,22 +124,125 @@ static PyObject * SShape_setName( BPy_SShape *self , PyObject *args) {
|
|||||||
// const vector< Material > & materials () const
|
// const vector< Material > & materials () const
|
||||||
// void SetMaterials (const vector< Material > &iMaterials)
|
// void SetMaterials (const vector< Material > &iMaterials)
|
||||||
|
|
||||||
/*----------------------SShape instance definitions ----------------------------*/
|
|
||||||
static PyMethodDef BPy_SShape_methods[] = {
|
static PyMethodDef BPy_SShape_methods[] = {
|
||||||
{"AddEdge", ( PyCFunction ) SShape_AddEdge, METH_VARARGS, SShape_AddEdge___doc__},
|
{"add_edge", (PyCFunction)SShape_add_edge, METH_VARARGS, SShape_add_edge_doc},
|
||||||
{"AddNewVertex", ( PyCFunction ) SShape_AddNewVertex, METH_VARARGS, SShape_AddNewVertex___doc__},
|
{"add_vertex", (PyCFunction)SShape_add_vertex, METH_VARARGS, SShape_add_vertex_doc},
|
||||||
{"setBBox", ( PyCFunction ) SShape_setBBox, METH_VARARGS, SShape_setBBox___doc__},
|
{"compute_bbox", (PyCFunction)SShape_compute_bbox, METH_NOARGS, SShape_compute_bbox_doc},
|
||||||
{"ComputeBBox", ( PyCFunction ) SShape_ComputeBBox, METH_NOARGS, SShape_ComputeBBox___doc__},
|
|
||||||
{"bbox", ( PyCFunction ) SShape_bbox, METH_NOARGS, SShape_bbox___doc__},
|
|
||||||
{"getVertexList", ( PyCFunction ) SShape_getVertexList, METH_NOARGS, SShape_getVertexList___doc__},
|
|
||||||
{"getEdgeList", ( PyCFunction ) SShape_getEdgeList, METH_NOARGS, SShape_getEdgeList___doc__},
|
|
||||||
{"getId", ( PyCFunction ) SShape_getId, METH_NOARGS, SShape_getId___doc__},
|
|
||||||
{"setId", ( PyCFunction ) SShape_setId, METH_VARARGS, SShape_setId___doc__},
|
|
||||||
{"getName", ( PyCFunction ) SShape_getName, METH_NOARGS, SShape_getName___doc__},
|
|
||||||
{"setName", ( PyCFunction ) SShape_setName, METH_VARARGS, SShape_setName___doc__},
|
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*----------------------SShape get/setters ----------------------------*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(SShape_id_doc,
|
||||||
|
"The Id of this SShape.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`Id`");
|
||||||
|
|
||||||
|
static PyObject *SShape_id_get(BPy_SShape *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
Id id(self->ss->getId());
|
||||||
|
return BPy_Id_from_Id(id); // return a copy
|
||||||
|
}
|
||||||
|
|
||||||
|
static int SShape_id_set(BPy_SShape *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!BPy_Id_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be an Id");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->ss->setId(*(((BPy_Id *)value)->id));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(SShape_name_doc,
|
||||||
|
"The name of the SShape.\n"
|
||||||
|
"\n"
|
||||||
|
":type: str");
|
||||||
|
|
||||||
|
static PyObject *SShape_name_get(BPy_SShape *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyUnicode_FromString(self->ss->getName().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
static int SShape_name_set(BPy_SShape *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!PyUnicode_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be a string");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
const string name = _PyUnicode_AsString(value);
|
||||||
|
self->ss->setName(name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(SShape_bbox_doc,
|
||||||
|
"The bounding box of the SShape.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`BBox`");
|
||||||
|
|
||||||
|
static PyObject *SShape_bbox_get(BPy_SShape *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
BBox<Vec3r> bb(self->ss->bbox());
|
||||||
|
return BPy_BBox_from_BBox(bb); // return a copy
|
||||||
|
}
|
||||||
|
|
||||||
|
static int SShape_bbox_set(BPy_SShape *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!BPy_BBox_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be a BBox");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->ss->setBBox(*(((BPy_BBox*)value)->bb));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(SShape_vertices_doc,
|
||||||
|
"The list of vertices constituting this SShape.\n"
|
||||||
|
"\n"
|
||||||
|
":type: List of :class:`SVertex` objects");
|
||||||
|
|
||||||
|
static PyObject *SShape_vertices_get(BPy_SShape *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
PyObject *py_vertices = PyList_New(0);
|
||||||
|
|
||||||
|
vector< SVertex * > vertices = self->ss->getVertexList();
|
||||||
|
vector< SVertex * >::iterator it;
|
||||||
|
|
||||||
|
for (it = vertices.begin(); it != vertices.end(); it++) {
|
||||||
|
PyList_Append(py_vertices, BPy_SVertex_from_SVertex(*(*it)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return py_vertices;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(SShape_edges_doc,
|
||||||
|
"The list of edges constituting this SShape.\n"
|
||||||
|
"\n"
|
||||||
|
":type: List of :class:`FEdge` objects");
|
||||||
|
|
||||||
|
static PyObject *SShape_edges_get(BPy_SShape *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
PyObject *py_edges = PyList_New(0);
|
||||||
|
|
||||||
|
vector< FEdge * > edges = self->ss->getEdgeList();
|
||||||
|
vector< FEdge * >::iterator it;
|
||||||
|
|
||||||
|
for (it = edges.begin(); it != edges.end(); it++) {
|
||||||
|
PyList_Append(py_edges, Any_BPy_FEdge_from_FEdge(*(*it)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return py_edges;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyGetSetDef BPy_SShape_getseters[] = {
|
||||||
|
{(char *)"id", (getter)SShape_id_get, (setter)SShape_id_set, (char *)SShape_id_doc, NULL},
|
||||||
|
{(char *)"name", (getter)SShape_name_get, (setter)SShape_name_set, (char *)SShape_name_doc, NULL},
|
||||||
|
{(char *)"bbox", (getter)SShape_bbox_get, (setter)SShape_bbox_set, (char *)SShape_bbox_doc, NULL},
|
||||||
|
{(char *)"edges", (getter)SShape_edges_get, (setter)NULL, (char *)SShape_edges_doc, NULL},
|
||||||
|
{(char *)"vertices", (getter)SShape_vertices_get, (setter)NULL, (char *)SShape_vertices_doc, NULL},
|
||||||
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||||
|
};
|
||||||
|
|
||||||
/*-----------------------BPy_SShape type definition ------------------------------*/
|
/*-----------------------BPy_SShape type definition ------------------------------*/
|
||||||
|
|
||||||
PyTypeObject SShape_Type = {
|
PyTypeObject SShape_Type = {
|
||||||
@@ -287,12 +250,12 @@ PyTypeObject SShape_Type = {
|
|||||||
"SShape", /* tp_name */
|
"SShape", /* tp_name */
|
||||||
sizeof(BPy_SShape), /* tp_basicsize */
|
sizeof(BPy_SShape), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)SShape___dealloc__, /* tp_dealloc */
|
(destructor)SShape_dealloc, /* tp_dealloc */
|
||||||
0, /* tp_print */
|
0, /* tp_print */
|
||||||
0, /* tp_getattr */
|
0, /* tp_getattr */
|
||||||
0, /* tp_setattr */
|
0, /* tp_setattr */
|
||||||
0, /* tp_reserved */
|
0, /* tp_reserved */
|
||||||
(reprfunc)SShape___repr__, /* tp_repr */
|
(reprfunc)SShape_repr, /* tp_repr */
|
||||||
0, /* tp_as_number */
|
0, /* tp_as_number */
|
||||||
0, /* tp_as_sequence */
|
0, /* tp_as_sequence */
|
||||||
0, /* tp_as_mapping */
|
0, /* tp_as_mapping */
|
||||||
@@ -303,7 +266,7 @@ PyTypeObject SShape_Type = {
|
|||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
SShape___doc__, /* tp_doc */
|
SShape_doc, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
@@ -312,13 +275,13 @@ PyTypeObject SShape_Type = {
|
|||||||
0, /* tp_iternext */
|
0, /* tp_iternext */
|
||||||
BPy_SShape_methods, /* tp_methods */
|
BPy_SShape_methods, /* tp_methods */
|
||||||
0, /* tp_members */
|
0, /* tp_members */
|
||||||
0, /* tp_getset */
|
BPy_SShape_getseters, /* tp_getset */
|
||||||
0, /* tp_base */
|
0, /* tp_base */
|
||||||
0, /* tp_dict */
|
0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
(initproc)SShape___init__, /* tp_init */
|
(initproc)SShape_init, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
PyType_GenericNew, /* tp_new */
|
PyType_GenericNew, /* tp_new */
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,48 +12,48 @@ extern "C" {
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//-------------------MODULE INITIALIZATION--------------------------------
|
//-------------------MODULE INITIALIZATION--------------------------------
|
||||||
int ViewMap_Init( PyObject *module )
|
int ViewMap_Init(PyObject *module)
|
||||||
{
|
{
|
||||||
if( module == NULL )
|
if (module == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( PyType_Ready( &ViewMap_Type ) < 0 )
|
if (PyType_Ready( &ViewMap_Type ) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
Py_INCREF(&ViewMap_Type);
|
||||||
Py_INCREF( &ViewMap_Type );
|
|
||||||
PyModule_AddObject(module, "ViewMap", (PyObject *)&ViewMap_Type);
|
PyModule_AddObject(module, "ViewMap", (PyObject *)&ViewMap_Type);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------INSTANCE METHODS ----------------------------------
|
/*----------------------ViewMap methods----------------------------*/
|
||||||
|
|
||||||
static char ViewMap___doc__[] =
|
PyDoc_STRVAR(ViewMap_doc,
|
||||||
"Class defining the ViewMap.\n"
|
"Class defining the ViewMap.\n"
|
||||||
"\n"
|
"\n"
|
||||||
".. method:: __init__()\n"
|
".. method:: __init__()\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Default constructor.\n";
|
" Default constructor.");
|
||||||
|
|
||||||
static int ViewMap___init__(BPy_ViewMap *self, PyObject *args, PyObject *kwds)
|
static int ViewMap_init(BPy_ViewMap *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
self->vm = new ViewMap();
|
self->vm = new ViewMap();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ViewMap___dealloc__(BPy_ViewMap *self)
|
static void ViewMap_dealloc(BPy_ViewMap *self)
|
||||||
{
|
{
|
||||||
if( self->vm )
|
if (self->vm)
|
||||||
delete self->vm;
|
delete self->vm;
|
||||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject * ViewMap___repr__(BPy_ViewMap *self)
|
static PyObject * ViewMap_repr(BPy_ViewMap *self)
|
||||||
{
|
{
|
||||||
return PyUnicode_FromFormat("ViewMap - address: %p", self->vm );
|
return PyUnicode_FromFormat("ViewMap - address: %p", self->vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char ViewMap_getClosestViewEdge___doc__[] =
|
PyDoc_STRVAR(ViewMap_get_closest_viewedge_doc,
|
||||||
".. method:: getClosestViewEdge(x, y)\n"
|
".. method:: get_closest_viewedge(x, y)\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Gets the ViewEdge nearest to the 2D point specified as arguments.\n"
|
" Gets the ViewEdge nearest to the 2D point specified as arguments.\n"
|
||||||
"\n"
|
"\n"
|
||||||
@@ -62,23 +62,22 @@ static char ViewMap_getClosestViewEdge___doc__[] =
|
|||||||
" :arg y: Y coordinate of a 2D point.\n"
|
" :arg y: Y coordinate of a 2D point.\n"
|
||||||
" :type y: float\n"
|
" :type y: float\n"
|
||||||
" :return: The ViewEdge nearest to the specified 2D point.\n"
|
" :return: The ViewEdge nearest to the specified 2D point.\n"
|
||||||
" :rtype: :class:`ViewEdge`\n";
|
" :rtype: :class:`ViewEdge`");
|
||||||
|
|
||||||
static PyObject * ViewMap_getClosestViewEdge( BPy_ViewMap *self , PyObject *args) {
|
static PyObject * ViewMap_get_closest_viewedge(BPy_ViewMap *self , PyObject *args)
|
||||||
|
{
|
||||||
double x, y;
|
double x, y;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "dd", &x, &y) ))
|
if (!PyArg_ParseTuple(args, "dd", &x, &y))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
ViewEdge *ve = const_cast<ViewEdge *>(self->vm->getClosestViewEdge(x,y));
|
||||||
ViewEdge *ve = const_cast<ViewEdge *>( self->vm->getClosestViewEdge(x,y) );
|
if (ve)
|
||||||
if( ve )
|
|
||||||
return BPy_ViewEdge_from_ViewEdge(*ve);
|
return BPy_ViewEdge_from_ViewEdge(*ve);
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char ViewMap_getClosestFEdge___doc__[] =
|
PyDoc_STRVAR(ViewMap_get_closest_fedge_doc,
|
||||||
".. method:: getClosestFEdge(x, y)\n"
|
".. method:: get_closest_fedge(x, y)\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Gets the FEdge nearest to the 2D point specified as arguments.\n"
|
" Gets the FEdge nearest to the 2D point specified as arguments.\n"
|
||||||
"\n"
|
"\n"
|
||||||
@@ -87,64 +86,55 @@ static char ViewMap_getClosestFEdge___doc__[] =
|
|||||||
" :arg y: Y coordinate of a 2D point.\n"
|
" :arg y: Y coordinate of a 2D point.\n"
|
||||||
" :type y: float\n"
|
" :type y: float\n"
|
||||||
" :return: The FEdge nearest to the specified 2D point.\n"
|
" :return: The FEdge nearest to the specified 2D point.\n"
|
||||||
" :rtype: :class:`FEdge`\n";
|
" :rtype: :class:`FEdge`");
|
||||||
|
|
||||||
static PyObject * ViewMap_getClosestFEdge( BPy_ViewMap *self , PyObject *args) {
|
static PyObject * ViewMap_get_closest_fedge(BPy_ViewMap *self , PyObject *args)
|
||||||
|
{
|
||||||
double x, y;
|
double x, y;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "dd", &x, &y) ))
|
if (!PyArg_ParseTuple(args, "dd", &x, &y))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
FEdge *fe = const_cast<FEdge *>(self->vm->getClosestFEdge(x,y));
|
||||||
FEdge *fe = const_cast<FEdge *>( self->vm->getClosestFEdge(x,y) );
|
if (fe)
|
||||||
if( fe )
|
|
||||||
return Any_BPy_FEdge_from_FEdge(*fe);
|
return Any_BPy_FEdge_from_FEdge(*fe);
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewMap_getScene3dBBox___doc__[] =
|
|
||||||
".. method:: getScene3dBBox()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the scene 3D bounding box.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The scene 3D bounding box.\n"
|
|
||||||
" :rtype: :class:`BBox`\n";
|
|
||||||
|
|
||||||
static PyObject * ViewMap_getScene3dBBox( BPy_ViewMap *self , PyObject *args) {
|
|
||||||
BBox<Vec3r> bb( self->vm->getScene3dBBox() );
|
|
||||||
return BPy_BBox_from_BBox( bb );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewMap_setScene3dBBox___doc__[] =
|
|
||||||
".. method:: setScene3dBBox(bbox)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the scene 3D bounding box.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg bbox: The scene 3D bounding box.\n"
|
|
||||||
" :type bbox: :class:`BBox`\n";
|
|
||||||
|
|
||||||
static PyObject * ViewMap_setScene3dBBox( BPy_ViewMap *self , PyObject *args) {
|
|
||||||
PyObject *py_bb = 0;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &BBox_Type, &py_bb) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->vm->setScene3dBBox(*( ((BPy_BBox *) py_bb)->bb ));
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static ViewMap *getInstance ();
|
// static ViewMap *getInstance ();
|
||||||
|
|
||||||
/*---------------------- BPy_ViewShape instance definitions ----------------------------*/
|
|
||||||
static PyMethodDef BPy_ViewMap_methods[] = {
|
static PyMethodDef BPy_ViewMap_methods[] = {
|
||||||
{"getClosestViewEdge", ( PyCFunction ) ViewMap_getClosestViewEdge, METH_VARARGS, ViewMap_getClosestViewEdge___doc__},
|
{"get_closest_viewedge", (PyCFunction)ViewMap_get_closest_viewedge, METH_VARARGS, ViewMap_get_closest_viewedge_doc},
|
||||||
{"getClosestFEdge", ( PyCFunction ) ViewMap_getClosestFEdge, METH_VARARGS, ViewMap_getClosestFEdge___doc__},
|
{"get_closest_fedge", (PyCFunction)ViewMap_get_closest_fedge, METH_VARARGS, ViewMap_get_closest_fedge_doc},
|
||||||
{"getScene3dBBox", ( PyCFunction ) ViewMap_getScene3dBBox, METH_NOARGS, ViewMap_getScene3dBBox___doc__},
|
|
||||||
{"setScene3dBBox", ( PyCFunction ) ViewMap_setScene3dBBox, METH_VARARGS, ViewMap_setScene3dBBox___doc__},
|
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*----------------------ViewMap get/setters ----------------------------*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(ViewMap_scene_bbox_doc,
|
||||||
|
"The 3D bounding box of the scene.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`BBox`");
|
||||||
|
|
||||||
|
static PyObject *ViewMap_scene_bbox_get(BPy_ViewMap *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return BPy_BBox_from_BBox(self->vm->getScene3dBBox());
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ViewMap_scene_bbox_set(BPy_ViewMap *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!BPy_BBox_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be a BBox");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->vm->setScene3dBBox(*(((BPy_BBox *)value)->bb));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyGetSetDef BPy_ViewMap_getseters[] = {
|
||||||
|
{(char *)"scene_bbox", (getter)ViewMap_scene_bbox_get, (setter)ViewMap_scene_bbox_set, (char *)ViewMap_scene_bbox_doc, NULL},
|
||||||
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||||
|
};
|
||||||
|
|
||||||
/*-----------------------BPy_ViewMap type definition ------------------------------*/
|
/*-----------------------BPy_ViewMap type definition ------------------------------*/
|
||||||
|
|
||||||
PyTypeObject ViewMap_Type = {
|
PyTypeObject ViewMap_Type = {
|
||||||
@@ -152,12 +142,12 @@ PyTypeObject ViewMap_Type = {
|
|||||||
"ViewMap", /* tp_name */
|
"ViewMap", /* tp_name */
|
||||||
sizeof(BPy_ViewMap), /* tp_basicsize */
|
sizeof(BPy_ViewMap), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)ViewMap___dealloc__, /* tp_dealloc */
|
(destructor)ViewMap_dealloc, /* tp_dealloc */
|
||||||
0, /* tp_print */
|
0, /* tp_print */
|
||||||
0, /* tp_getattr */
|
0, /* tp_getattr */
|
||||||
0, /* tp_setattr */
|
0, /* tp_setattr */
|
||||||
0, /* tp_reserved */
|
0, /* tp_reserved */
|
||||||
(reprfunc)ViewMap___repr__, /* tp_repr */
|
(reprfunc)ViewMap_repr, /* tp_repr */
|
||||||
0, /* tp_as_number */
|
0, /* tp_as_number */
|
||||||
0, /* tp_as_sequence */
|
0, /* tp_as_sequence */
|
||||||
0, /* tp_as_mapping */
|
0, /* tp_as_mapping */
|
||||||
@@ -168,7 +158,7 @@ PyTypeObject ViewMap_Type = {
|
|||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
ViewMap___doc__, /* tp_doc */
|
ViewMap_doc, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
@@ -177,13 +167,13 @@ PyTypeObject ViewMap_Type = {
|
|||||||
0, /* tp_iternext */
|
0, /* tp_iternext */
|
||||||
BPy_ViewMap_methods, /* tp_methods */
|
BPy_ViewMap_methods, /* tp_methods */
|
||||||
0, /* tp_members */
|
0, /* tp_members */
|
||||||
0, /* tp_getset */
|
BPy_ViewMap_getseters, /* tp_getset */
|
||||||
0, /* tp_base */
|
0, /* tp_base */
|
||||||
0, /* tp_dict */
|
0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
(initproc)ViewMap___init__, /* tp_init */
|
(initproc)ViewMap_init, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
PyType_GenericNew, /* tp_new */
|
PyType_GenericNew, /* tp_new */
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,22 +12,23 @@ extern "C" {
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//-------------------MODULE INITIALIZATION--------------------------------
|
//-------------------MODULE INITIALIZATION--------------------------------
|
||||||
int ViewShape_Init( PyObject *module )
|
|
||||||
|
int ViewShape_Init(PyObject *module)
|
||||||
{
|
{
|
||||||
if( module == NULL )
|
if (module == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( PyType_Ready( &ViewShape_Type ) < 0 )
|
if (PyType_Ready(&ViewShape_Type) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
Py_INCREF(&ViewShape_Type);
|
||||||
Py_INCREF( &ViewShape_Type );
|
|
||||||
PyModule_AddObject(module, "ViewShape", (PyObject *)&ViewShape_Type);
|
PyModule_AddObject(module, "ViewShape", (PyObject *)&ViewShape_Type);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------INSTANCE METHODS ----------------------------------
|
/*----------------------ViewShape methods ----------------------------*/
|
||||||
|
|
||||||
static char ViewShape___doc__[] =
|
PyDoc_STRVAR(ViewShape_doc,
|
||||||
"Class gathering the elements of the ViewMap (i.e., :class:`ViewVertex`\n"
|
"Class gathering the elements of the ViewMap (i.e., :class:`ViewVertex`\n"
|
||||||
"and :class:`ViewEdge`) that are issued from the same input shape.\n"
|
"and :class:`ViewEdge`) that are issued from the same input shape.\n"
|
||||||
"\n"
|
"\n"
|
||||||
@@ -47,23 +48,23 @@ static char ViewShape___doc__[] =
|
|||||||
" Builds a ViewShape from an SShape.\n"
|
" Builds a ViewShape from an SShape.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg iSShape: An SShape object.\n"
|
" :arg iSShape: An SShape object.\n"
|
||||||
" :type iSShape: :class:`SShape`\n";
|
" :type iSShape: :class:`SShape`");
|
||||||
|
|
||||||
static int ViewShape___init__(BPy_ViewShape *self, PyObject *args, PyObject *kwds)
|
static int ViewShape_init(BPy_ViewShape *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyObject *obj;
|
PyObject *obj;
|
||||||
|
|
||||||
if (! PyArg_ParseTuple(args, "|O", &obj) )
|
if (!PyArg_ParseTuple(args, "|O", &obj))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( !obj ) {
|
if (!obj) {
|
||||||
self->vs = new ViewShape();
|
self->vs = new ViewShape();
|
||||||
|
|
||||||
} else if( BPy_SShape_Check(obj) ) {
|
} else if (BPy_SShape_Check(obj)) {
|
||||||
self->vs = new ViewShape( ((BPy_SShape *) obj)->ss );
|
self->vs = new ViewShape(((BPy_SShape *)obj)->ss);
|
||||||
|
|
||||||
} else if( BPy_ViewShape_Check(obj) ) {
|
} else if (BPy_ViewShape_Check(obj)) {
|
||||||
self->vs = new ViewShape(*( ((BPy_ViewShape *) obj)->vs ));
|
self->vs = new ViewShape(*(((BPy_ViewShape *)obj)->vs));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError, "invalid argument");
|
PyErr_SetString(PyExc_TypeError, "invalid argument");
|
||||||
@@ -71,238 +72,198 @@ static int ViewShape___init__(BPy_ViewShape *self, PyObject *args, PyObject *kwd
|
|||||||
}
|
}
|
||||||
self->borrowed = 0;
|
self->borrowed = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ViewShape___dealloc__(BPy_ViewShape *self)
|
static void ViewShape_dealloc(BPy_ViewShape *self)
|
||||||
{
|
{
|
||||||
if( self->vs && !self->borrowed )
|
if (self->vs && !self->borrowed)
|
||||||
delete self->vs;
|
delete self->vs;
|
||||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject * ViewShape___repr__(BPy_ViewShape *self)
|
static PyObject * ViewShape_repr(BPy_ViewShape *self)
|
||||||
{
|
{
|
||||||
return PyUnicode_FromFormat("ViewShape - address: %p", self->vs );
|
return PyUnicode_FromFormat("ViewShape - address: %p", self->vs );
|
||||||
}
|
}
|
||||||
|
|
||||||
static char ViewShape_sshape___doc__[] =
|
PyDoc_STRVAR(ViewShape_add_edge_doc,
|
||||||
".. method:: sshape()\n"
|
".. method:: add_edge(iEdge)\n"
|
||||||
"\n"
|
|
||||||
" Returns the SShape on top of which this ViewShape is built.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The SShape on top of which this ViewShape is built.\n"
|
|
||||||
" :rtype: :class:`SShape`\n";
|
|
||||||
|
|
||||||
static PyObject * ViewShape_sshape( BPy_ViewShape *self ) {
|
|
||||||
return BPy_SShape_from_SShape( *(self->vs->sshape()) );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewShape_vertices___doc__[] =
|
|
||||||
".. method:: vertices()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the list of ViewVertex objects contained in this ViewShape.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The list of ViewVertex objects.\n"
|
|
||||||
" :rtype: List of :class:`ViewVertex` objects\n";
|
|
||||||
|
|
||||||
static PyObject * ViewShape_vertices( BPy_ViewShape *self ) {
|
|
||||||
PyObject *py_vertices = PyList_New(0);
|
|
||||||
|
|
||||||
vector< ViewVertex * > vertices = self->vs->vertices();
|
|
||||||
vector< ViewVertex * >::iterator it;
|
|
||||||
|
|
||||||
for( it = vertices.begin(); it != vertices.end(); it++ ) {
|
|
||||||
PyList_Append( py_vertices, Any_BPy_ViewVertex_from_ViewVertex(*( *it )) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return py_vertices;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewShape_edges___doc__[] =
|
|
||||||
".. method:: edges()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the list of ViewEdge objects contained in this ViewShape.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The list of ViewEdge objects.\n"
|
|
||||||
" :rtype: List of :class:`ViewEdge` objects\n";
|
|
||||||
|
|
||||||
static PyObject * ViewShape_edges( BPy_ViewShape *self ) {
|
|
||||||
PyObject *py_edges = PyList_New(0);
|
|
||||||
|
|
||||||
vector< ViewEdge * > edges = self->vs->edges();
|
|
||||||
vector< ViewEdge * >::iterator it;
|
|
||||||
|
|
||||||
for( it = edges.begin(); it != edges.end(); it++ ) {
|
|
||||||
PyList_Append( py_edges, BPy_ViewEdge_from_ViewEdge(*( *it )) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return py_edges;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewShape_getId___doc__[] =
|
|
||||||
".. method:: getId()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the ViewShape id.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: An Id object.\n"
|
|
||||||
" :rtype: :class:`Id`\n";
|
|
||||||
|
|
||||||
static PyObject * ViewShape_getId( BPy_ViewShape *self ) {
|
|
||||||
Id id( self->vs->getId() );
|
|
||||||
return BPy_Id_from_Id( id );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewShape_getName___doc__[] =
|
|
||||||
".. method:: getName()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the name of the ViewShape.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The name string.\n"
|
|
||||||
" :rtype: str\n";
|
|
||||||
|
|
||||||
static PyObject * ViewShape_getName( BPy_ViewShape *self ) {
|
|
||||||
return PyUnicode_FromString( self->vs->getName().c_str() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewShape_setSShape___doc__[] =
|
|
||||||
".. method:: setSShape(iSShape)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the SShape on top of which the ViewShape is built.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iSShape: An SShape object.\n"
|
|
||||||
" :type iSShape: :class:`SShape`\n";
|
|
||||||
|
|
||||||
static PyObject * ViewShape_setSShape( BPy_ViewShape *self , PyObject *args) {
|
|
||||||
PyObject *py_ss = 0;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &SShape_Type, &py_ss) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->vs->setSShape( ((BPy_SShape *) py_ss)->ss );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewShape_setVertices___doc__[] =
|
|
||||||
".. method:: setVertices(iVertices)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the list of ViewVertex objects contained in this ViewShape.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iVertices: The list of ViewVertex objects.\n"
|
|
||||||
" :type iVertices: List of :class:`ViewVertex` objects\n";
|
|
||||||
|
|
||||||
static PyObject * ViewShape_setVertices( BPy_ViewShape *self , PyObject *args) {
|
|
||||||
PyObject *list = 0;
|
|
||||||
PyObject *tmp;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &PyList_Type, &list) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
vector< ViewVertex *> v;
|
|
||||||
|
|
||||||
for( int i=0; i < PyList_Size(list); i++ ) {
|
|
||||||
tmp = PyList_GetItem(list, i);
|
|
||||||
if( BPy_ViewVertex_Check(tmp) )
|
|
||||||
v.push_back( ((BPy_ViewVertex *) tmp)->vv );
|
|
||||||
else {
|
|
||||||
PyErr_SetString(PyExc_TypeError, "argument must be list of ViewVertex objects");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self->vs->setVertices( v );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewShape_setEdges___doc__[] =
|
|
||||||
".. method:: setEdges(iEdges)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the list of ViewEdge objects contained in this ViewShape.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iEdges: The list of ViewEdge objects.\n"
|
|
||||||
" :type iEdges: List of :class:`ViewEdge` objects.\n";
|
|
||||||
|
|
||||||
static PyObject * ViewShape_setEdges( BPy_ViewShape *self , PyObject *args) {
|
|
||||||
PyObject *list = 0;
|
|
||||||
PyObject *tmp;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &PyList_Type, &list) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
vector<ViewEdge *> v;
|
|
||||||
|
|
||||||
for( int i=0; i < PyList_Size(list); i++ ) {
|
|
||||||
tmp = PyList_GetItem(list, i);
|
|
||||||
if( BPy_ViewEdge_Check(tmp) )
|
|
||||||
v.push_back( ((BPy_ViewEdge *) tmp)->ve );
|
|
||||||
else {
|
|
||||||
PyErr_SetString(PyExc_TypeError, "argument must be list of ViewEdge objects");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self->vs->setEdges( v );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewShape_AddEdge___doc__[] =
|
|
||||||
".. method:: AddEdge(iEdge)\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
" Adds a ViewEdge to the list of ViewEdge objects.\n"
|
" Adds a ViewEdge to the list of ViewEdge objects.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg iEdge: A ViewEdge object.\n"
|
" :arg iEdge: A ViewEdge object.\n"
|
||||||
" :type iEdge: :class:`ViewEdge`\n";
|
" :type iEdge: :class:`ViewEdge`\n");
|
||||||
|
|
||||||
static PyObject * ViewShape_AddEdge( BPy_ViewShape *self , PyObject *args) {
|
static PyObject * ViewShape_add_edge(BPy_ViewShape *self , PyObject *args)
|
||||||
|
{
|
||||||
PyObject *py_ve = 0;
|
PyObject *py_ve = 0;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &ViewEdge_Type, &py_ve) ))
|
if (!PyArg_ParseTuple(args, "O!", &ViewEdge_Type, &py_ve))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
self->vs->AddEdge(((BPy_ViewEdge *)py_ve)->ve);
|
||||||
self->vs->AddEdge( ((BPy_ViewEdge *) py_ve)->ve );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char ViewShape_AddVertex___doc__[] =
|
PyDoc_STRVAR(ViewShape_add_vertex_doc,
|
||||||
".. method:: AddVertex(iVertex)\n"
|
".. method:: add_vertex(iVertex)\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Adds a ViewVertex to the list of the ViewVertex objects.\n"
|
" Adds a ViewVertex to the list of the ViewVertex objects.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg iVertex: A ViewVertex object.\n"
|
" :arg iVertex: A ViewVertex object.\n"
|
||||||
" :type iVertex: :class:`ViewVertex`\n";
|
" :type iVertex: :class:`ViewVertex`");
|
||||||
|
|
||||||
static PyObject * ViewShape_AddVertex( BPy_ViewShape *self , PyObject *args) {
|
static PyObject * ViewShape_add_vertex(BPy_ViewShape *self , PyObject *args)
|
||||||
|
{
|
||||||
PyObject *py_vv = 0;
|
PyObject *py_vv = 0;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &ViewVertex_Type, &py_vv) ))
|
if (!PyArg_ParseTuple(args, "O!", &ViewVertex_Type, &py_vv))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
self->vs->AddVertex(((BPy_ViewVertex *)py_vv)->vv);
|
||||||
self->vs->AddVertex( ((BPy_ViewVertex *) py_vv)->vv );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// virtual ViewShape * duplicate ()
|
// virtual ViewShape *duplicate()
|
||||||
|
|
||||||
/*---------------------- BPy_ViewShape instance definitions ----------------------------*/
|
|
||||||
static PyMethodDef BPy_ViewShape_methods[] = {
|
static PyMethodDef BPy_ViewShape_methods[] = {
|
||||||
{"sshape", ( PyCFunction ) ViewShape_sshape, METH_NOARGS, ViewShape_sshape___doc__},
|
{"add_edge", (PyCFunction)ViewShape_add_edge, METH_VARARGS, ViewShape_add_edge_doc},
|
||||||
{"vertices", ( PyCFunction ) ViewShape_vertices, METH_NOARGS, ViewShape_vertices___doc__},
|
{"add_vertex", (PyCFunction)ViewShape_add_vertex, METH_VARARGS, ViewShape_add_vertex_doc},
|
||||||
{"edges", ( PyCFunction ) ViewShape_edges, METH_NOARGS, ViewShape_edges___doc__},
|
|
||||||
{"getId", ( PyCFunction ) ViewShape_getId, METH_NOARGS, ViewShape_getId___doc__},
|
|
||||||
{"getName", ( PyCFunction ) ViewShape_getName, METH_NOARGS, ViewShape_getName___doc__},
|
|
||||||
{"setSShape", ( PyCFunction ) ViewShape_setSShape, METH_VARARGS, ViewShape_setSShape___doc__},
|
|
||||||
{"setVertices", ( PyCFunction ) ViewShape_setVertices, METH_VARARGS, ViewShape_setVertices___doc__},
|
|
||||||
{"setEdges", ( PyCFunction ) ViewShape_setEdges, METH_VARARGS, ViewShape_setEdges___doc__},
|
|
||||||
{"AddEdge", ( PyCFunction ) ViewShape_AddEdge, METH_VARARGS, ViewShape_AddEdge___doc__},
|
|
||||||
{"AddVertex", ( PyCFunction ) ViewShape_AddVertex, METH_VARARGS, ViewShape_AddVertex___doc__},
|
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*----------------------ViewShape get/setters ----------------------------*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(ViewShape_sshape_doc,
|
||||||
|
"The SShape on top of which this ViewShape is built.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`SShape`");
|
||||||
|
|
||||||
|
static PyObject *ViewShape_sshape_get(BPy_ViewShape *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return BPy_SShape_from_SShape(*(self->vs->sshape()));
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ViewShape_sshape_set(BPy_ViewShape *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!BPy_SShape_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be an SShape");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->vs->setSShape(((BPy_SShape *)value)->ss);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(ViewShape_vertices_doc,
|
||||||
|
"The list of ViewVertex objects contained in this ViewShape.\n"
|
||||||
|
"\n"
|
||||||
|
":type: List of :class:`ViewVertex` objects");
|
||||||
|
|
||||||
|
static PyObject *ViewShape_vertices_get(BPy_ViewShape *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
PyObject *py_vertices = PyList_New(0);
|
||||||
|
|
||||||
|
vector< ViewVertex * > vertices = self->vs->vertices();
|
||||||
|
vector< ViewVertex * >::iterator it;
|
||||||
|
for (it = vertices.begin(); it != vertices.end(); it++) {
|
||||||
|
PyList_Append( py_vertices, Any_BPy_ViewVertex_from_ViewVertex(*(*it)));
|
||||||
|
}
|
||||||
|
return py_vertices;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ViewShape_vertices_set(BPy_ViewShape *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
PyObject *list = 0;
|
||||||
|
PyObject *item;
|
||||||
|
vector< ViewVertex *> v;
|
||||||
|
|
||||||
|
if (!PyList_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be a list of ViewVertex objects");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < PyList_Size(list); i++) {
|
||||||
|
item = PyList_GetItem(list, i);
|
||||||
|
if (BPy_ViewVertex_Check(item)) {
|
||||||
|
v.push_back(((BPy_ViewVertex *)item)->vv);
|
||||||
|
} else {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be a list of ViewVertex objects");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self->vs->setVertices(v);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(ViewShape_edges_doc,
|
||||||
|
"The list of ViewEdge objects contained in this ViewShape.\n"
|
||||||
|
"\n"
|
||||||
|
":type: List of :class:`ViewEdge` objects");
|
||||||
|
|
||||||
|
static PyObject *ViewShape_edges_get(BPy_ViewShape *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
PyObject *py_edges = PyList_New(0);
|
||||||
|
|
||||||
|
vector< ViewEdge * > edges = self->vs->edges();
|
||||||
|
vector< ViewEdge * >::iterator it;
|
||||||
|
|
||||||
|
for (it = edges.begin(); it != edges.end(); it++) {
|
||||||
|
PyList_Append(py_edges, BPy_ViewEdge_from_ViewEdge(*(*it)));
|
||||||
|
}
|
||||||
|
return py_edges;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ViewShape_edges_set(BPy_ViewShape *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
PyObject *list = 0;
|
||||||
|
PyObject *item;
|
||||||
|
vector<ViewEdge *> v;
|
||||||
|
|
||||||
|
if (!PyList_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be a list of ViewEdge objects");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < PyList_Size(list); i++) {
|
||||||
|
item = PyList_GetItem(list, i);
|
||||||
|
if (BPy_ViewEdge_Check(item)) {
|
||||||
|
v.push_back(((BPy_ViewEdge *)item)->ve);
|
||||||
|
} else {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "argument must be list of ViewEdge objects");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self->vs->setEdges(v);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(ViewShape_name_doc,
|
||||||
|
"The name of the ViewShape.\n"
|
||||||
|
"\n"
|
||||||
|
":type: str");
|
||||||
|
|
||||||
|
static PyObject *ViewShape_name_get(BPy_ViewShape *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyUnicode_FromString(self->vs->getName().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(ViewShape_id_doc,
|
||||||
|
"The Id of this ViewShape.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`Id`");
|
||||||
|
|
||||||
|
static PyObject *ViewShape_id_get(BPy_ViewShape *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
Id id(self->vs->getId());
|
||||||
|
return BPy_Id_from_Id(id); // return a copy
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyGetSetDef BPy_ViewShape_getseters[] = {
|
||||||
|
{(char *)"sshape", (getter)ViewShape_sshape_get, (setter)ViewShape_sshape_set, (char *)ViewShape_sshape_doc, NULL},
|
||||||
|
{(char *)"vertices", (getter)ViewShape_vertices_get, (setter)ViewShape_vertices_set, (char *)ViewShape_vertices_doc, NULL},
|
||||||
|
{(char *)"edges", (getter)ViewShape_edges_get, (setter)ViewShape_edges_set, (char *)ViewShape_edges_doc, NULL},
|
||||||
|
{(char *)"name", (getter)ViewShape_name_get, (setter)NULL, (char *)ViewShape_name_doc, NULL},
|
||||||
|
{(char *)"id", (getter)ViewShape_id_get, (setter)NULL, (char *)ViewShape_id_doc, NULL},
|
||||||
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||||
|
};
|
||||||
|
|
||||||
/*-----------------------BPy_ViewShape type definition ------------------------------*/
|
/*-----------------------BPy_ViewShape type definition ------------------------------*/
|
||||||
|
|
||||||
PyTypeObject ViewShape_Type = {
|
PyTypeObject ViewShape_Type = {
|
||||||
@@ -310,12 +271,12 @@ PyTypeObject ViewShape_Type = {
|
|||||||
"ViewShape", /* tp_name */
|
"ViewShape", /* tp_name */
|
||||||
sizeof(BPy_ViewShape), /* tp_basicsize */
|
sizeof(BPy_ViewShape), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)ViewShape___dealloc__, /* tp_dealloc */
|
(destructor)ViewShape_dealloc, /* tp_dealloc */
|
||||||
0, /* tp_print */
|
0, /* tp_print */
|
||||||
0, /* tp_getattr */
|
0, /* tp_getattr */
|
||||||
0, /* tp_setattr */
|
0, /* tp_setattr */
|
||||||
0, /* tp_reserved */
|
0, /* tp_reserved */
|
||||||
(reprfunc)ViewShape___repr__, /* tp_repr */
|
(reprfunc)ViewShape_repr, /* tp_repr */
|
||||||
0, /* tp_as_number */
|
0, /* tp_as_number */
|
||||||
0, /* tp_as_sequence */
|
0, /* tp_as_sequence */
|
||||||
0, /* tp_as_mapping */
|
0, /* tp_as_mapping */
|
||||||
@@ -326,7 +287,7 @@ PyTypeObject ViewShape_Type = {
|
|||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
ViewShape___doc__, /* tp_doc */
|
ViewShape_doc, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
@@ -335,13 +296,13 @@ PyTypeObject ViewShape_Type = {
|
|||||||
0, /* tp_iternext */
|
0, /* tp_iternext */
|
||||||
BPy_ViewShape_methods, /* tp_methods */
|
BPy_ViewShape_methods, /* tp_methods */
|
||||||
0, /* tp_members */
|
0, /* tp_members */
|
||||||
0, /* tp_getset */
|
BPy_ViewShape_getseters, /* tp_getset */
|
||||||
0, /* tp_base */
|
0, /* tp_base */
|
||||||
0, /* tp_dict */
|
0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
(initproc)ViewShape___init__, /* tp_init */
|
(initproc)ViewShape_init, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
PyType_GenericNew, /* tp_new */
|
PyType_GenericNew, /* tp_new */
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ extern "C" {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//------------------------INSTANCE METHODS ----------------------------------
|
/*----------------------CurvePoint methods----------------------------*/
|
||||||
|
|
||||||
static char CurvePoint___doc__[] =
|
PyDoc_STRVAR(CurvePoint_doc,
|
||||||
"Class hierarchy: :class:`Interface0D` > :class:`CurvePoint`\n"
|
"Class hierarchy: :class:`Interface0D` > :class:`CurvePoint`\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Class to represent a point of a curve. A CurvePoint can be any point\n"
|
"Class to represent a point of a curve. A CurvePoint can be any point\n"
|
||||||
@@ -57,15 +57,15 @@ static char CurvePoint___doc__[] =
|
|||||||
" :type iB: :class:`CurvePoint`\n"
|
" :type iB: :class:`CurvePoint`\n"
|
||||||
" :arg t2d: The 2D interpolation parameter used to linearly\n"
|
" :arg t2d: The 2D interpolation parameter used to linearly\n"
|
||||||
" interpolate iA and iB.\n"
|
" interpolate iA and iB.\n"
|
||||||
" :type t2d: float\n";
|
" :type t2d: float");
|
||||||
|
|
||||||
static int CurvePoint___init__(BPy_CurvePoint *self, PyObject *args, PyObject *kwds)
|
static int CurvePoint_init(BPy_CurvePoint *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
|
|
||||||
PyObject *obj1 = 0, *obj2 = 0 , *obj3 = 0;
|
PyObject *obj1 = 0, *obj2 = 0 , *obj3 = 0;
|
||||||
|
|
||||||
if (! PyArg_ParseTuple(args, "|OOO!", &obj1, &obj2, &PyFloat_Type, &obj3) )
|
if (! PyArg_ParseTuple(args, "|OOO!", &obj1, &obj2, &PyFloat_Type, &obj3) )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( !obj1 ){
|
if( !obj1 ){
|
||||||
self->cp = new CurvePoint();
|
self->cp = new CurvePoint();
|
||||||
@@ -102,133 +102,101 @@ static int CurvePoint___init__(BPy_CurvePoint *self, PyObject *args, PyObject *k
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char CurvePoint_A___doc__[] =
|
|
||||||
".. method:: A()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the first SVertex upon which the CurvePoint is built.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The first SVertex.\n"
|
|
||||||
" :rtype: :class:`SVertex`\n";
|
|
||||||
|
|
||||||
static PyObject * CurvePoint_A( BPy_CurvePoint *self ) {
|
|
||||||
SVertex *A = self->cp->A();
|
|
||||||
if( A )
|
|
||||||
return BPy_SVertex_from_SVertex( *A );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char CurvePoint_B___doc__[] =
|
|
||||||
".. method:: B()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the second SVertex upon which the CurvePoint is built.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The second SVertex.\n"
|
|
||||||
" :rtype: :class:`SVertex`\n";
|
|
||||||
|
|
||||||
static PyObject * CurvePoint_B( BPy_CurvePoint *self ) {
|
|
||||||
SVertex *B = self->cp->B();
|
|
||||||
if( B )
|
|
||||||
return BPy_SVertex_from_SVertex( *B );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char CurvePoint_t2d___doc__[] =
|
|
||||||
".. method:: t2d()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the 2D interpolation parameter.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The 2D interpolation parameter.\n"
|
|
||||||
" :rtype: float\n";
|
|
||||||
|
|
||||||
static PyObject * CurvePoint_t2d( BPy_CurvePoint *self ) {
|
|
||||||
return PyFloat_FromDouble( self->cp->t2d() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char CurvePoint_setA___doc__[] =
|
|
||||||
".. method:: setA(iA)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the first SVertex upon which to build the CurvePoint.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iA: The first SVertex.\n"
|
|
||||||
" :type iA: :class:`SVertex`\n";
|
|
||||||
|
|
||||||
static PyObject *CurvePoint_setA( BPy_CurvePoint *self , PyObject *args) {
|
|
||||||
PyObject *py_sv;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &SVertex_Type, &py_sv) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->cp->setA( ((BPy_SVertex *) py_sv)->sv );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char CurvePoint_setB___doc__[] =
|
|
||||||
".. method:: setB(iB)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the first SVertex upon which to build the CurvePoint.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iB: The second SVertex.\n"
|
|
||||||
" :type iB: :class:`SVertex`\n";
|
|
||||||
|
|
||||||
static PyObject *CurvePoint_setB( BPy_CurvePoint *self , PyObject *args) {
|
|
||||||
PyObject *py_sv;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &SVertex_Type, &py_sv) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->cp->setB( ((BPy_SVertex *) py_sv)->sv );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char CurvePoint_setT2d___doc__[] =
|
|
||||||
".. method:: setT2d(t)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the 2D interpolation parameter to use.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg t: The 2D interpolation parameter.\n"
|
|
||||||
" :type t: float\n";
|
|
||||||
|
|
||||||
static PyObject *CurvePoint_setT2d( BPy_CurvePoint *self , PyObject *args) {
|
|
||||||
float t;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "f", &t) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->cp->setT2d( t );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char CurvePoint_curvatureFredo___doc__[] =
|
|
||||||
".. method:: curvatureFredo()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the angle in radians.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The angle in radians.\n"
|
|
||||||
" :rtype: float\n";
|
|
||||||
|
|
||||||
static PyObject *CurvePoint_curvatureFredo( BPy_CurvePoint *self , PyObject *args) {
|
|
||||||
return PyFloat_FromDouble( self->cp->curvatureFredo() );
|
|
||||||
}
|
|
||||||
|
|
||||||
///bool operator== (const CurvePoint &b)
|
///bool operator== (const CurvePoint &b)
|
||||||
|
|
||||||
/*----------------------CurvePoint instance definitions ----------------------------*/
|
static PyMethodDef BPy_CurvePoint_methods[] = {
|
||||||
static PyMethodDef BPy_CurvePoint_methods[] = {
|
|
||||||
{"A", ( PyCFunction ) CurvePoint_A, METH_NOARGS, CurvePoint_A___doc__},
|
|
||||||
{"B", ( PyCFunction ) CurvePoint_B, METH_NOARGS, CurvePoint_B___doc__},
|
|
||||||
{"t2d", ( PyCFunction ) CurvePoint_t2d, METH_NOARGS, CurvePoint_t2d___doc__},
|
|
||||||
{"setA", ( PyCFunction ) CurvePoint_setA, METH_VARARGS, CurvePoint_setA___doc__},
|
|
||||||
{"setB", ( PyCFunction ) CurvePoint_setB, METH_VARARGS, CurvePoint_setB___doc__},
|
|
||||||
{"setT2d", ( PyCFunction ) CurvePoint_setT2d, METH_VARARGS, CurvePoint_setT2d___doc__},
|
|
||||||
{"curvatureFredo", ( PyCFunction ) CurvePoint_curvatureFredo, METH_NOARGS, CurvePoint_curvatureFredo___doc__},
|
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*----------------------CurvePoint get/setters ----------------------------*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(CurvePoint_first_svertex_doc,
|
||||||
|
"The first SVertex upon which the CurvePoint is built.\n"
|
||||||
|
"\n"
|
||||||
|
":type: int");
|
||||||
|
|
||||||
|
static PyObject *CurvePoint_first_svertex_get(BPy_CurvePoint *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
SVertex *A = self->cp->A();
|
||||||
|
if (A)
|
||||||
|
return BPy_SVertex_from_SVertex(*A);
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int CurvePoint_first_svertex_set(BPy_CurvePoint *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!BPy_SVertex_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be an SVertex");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->cp->setA(((BPy_SVertex *)value)->sv);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(CurvePoint_second_svertex_doc,
|
||||||
|
"The second SVertex upon which the CurvePoint is built.\n"
|
||||||
|
"\n"
|
||||||
|
":type: int");
|
||||||
|
|
||||||
|
static PyObject *CurvePoint_second_svertex_get(BPy_CurvePoint *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
SVertex *B = self->cp->B();
|
||||||
|
if (B)
|
||||||
|
return BPy_SVertex_from_SVertex(*B);
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int CurvePoint_second_svertex_set(BPy_CurvePoint *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!BPy_SVertex_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be an SVertex");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->cp->setB(((BPy_SVertex *)value)->sv);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(CurvePoint_t2d_doc,
|
||||||
|
"The 2D interpolation parameter.\n"
|
||||||
|
"\n"
|
||||||
|
":type: float");
|
||||||
|
|
||||||
|
static PyObject *CurvePoint_t2d_get(BPy_CurvePoint *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyFloat_FromDouble(self->cp->t2d());
|
||||||
|
}
|
||||||
|
|
||||||
|
static int CurvePoint_t2d_set(BPy_CurvePoint *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
float scalar;
|
||||||
|
if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be a number");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->cp->setT2d(scalar);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(CurvePoint_curvature_fredo_doc,
|
||||||
|
"The angle (Fredo's curvature) in radians.\n"
|
||||||
|
"\n"
|
||||||
|
":type: float");
|
||||||
|
|
||||||
|
static PyObject *CurvePoint_curvature_fredo_get(BPy_CurvePoint *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyFloat_FromDouble(self->cp->curvatureFredo());
|
||||||
|
}
|
||||||
|
|
||||||
|
// todo - CurvePoint.directionFredo()
|
||||||
|
|
||||||
|
static PyGetSetDef BPy_CurvePoint_getseters[] = {
|
||||||
|
{(char *)"first_svertex", (getter)CurvePoint_first_svertex_get, (setter)CurvePoint_first_svertex_set, (char *)CurvePoint_first_svertex_doc, NULL},
|
||||||
|
{(char *)"second_svertex", (getter)CurvePoint_second_svertex_get, (setter)CurvePoint_second_svertex_set, (char *)CurvePoint_second_svertex_doc, NULL},
|
||||||
|
{(char *)"t2d", (getter)CurvePoint_t2d_get, (setter)CurvePoint_t2d_set, (char *)CurvePoint_t2d_doc, NULL},
|
||||||
|
{(char *)"curvature_fredo", (getter)CurvePoint_curvature_fredo_get, (setter)NULL, (char *)CurvePoint_curvature_fredo_doc, NULL},
|
||||||
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||||
|
};
|
||||||
|
|
||||||
/*-----------------------BPy_CurvePoint type definition ------------------------------*/
|
/*-----------------------BPy_CurvePoint type definition ------------------------------*/
|
||||||
PyTypeObject CurvePoint_Type = {
|
PyTypeObject CurvePoint_Type = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
@@ -251,7 +219,7 @@ PyTypeObject CurvePoint_Type = {
|
|||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
CurvePoint___doc__, /* tp_doc */
|
CurvePoint_doc, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
@@ -260,13 +228,13 @@ PyTypeObject CurvePoint_Type = {
|
|||||||
0, /* tp_iternext */
|
0, /* tp_iternext */
|
||||||
BPy_CurvePoint_methods, /* tp_methods */
|
BPy_CurvePoint_methods, /* tp_methods */
|
||||||
0, /* tp_members */
|
0, /* tp_members */
|
||||||
0, /* tp_getset */
|
BPy_CurvePoint_getseters, /* tp_getset */
|
||||||
&Interface0D_Type, /* tp_base */
|
&Interface0D_Type, /* tp_base */
|
||||||
0, /* tp_dict */
|
0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
(initproc)CurvePoint___init__, /* tp_init */
|
(initproc)CurvePoint_init, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
0, /* tp_new */
|
0, /* tp_new */
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ extern "C" {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static char SVertex___doc__[] =
|
/*----------------------SVertex methods ----------------------------*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(SVertex_doc,
|
||||||
"Class hierarchy: :class:`Interface0D` > :class:`SVertex`\n"
|
"Class hierarchy: :class:`Interface0D` > :class:`SVertex`\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Class to define a vertex of the embedding.\n"
|
"Class to define a vertex of the embedding.\n"
|
||||||
@@ -33,32 +35,29 @@ static char SVertex___doc__[] =
|
|||||||
" :arg iPoint3D: A three-dimensional vector.\n"
|
" :arg iPoint3D: A three-dimensional vector.\n"
|
||||||
" :type iPoint3D: :class:`mathutils.Vector`\n"
|
" :type iPoint3D: :class:`mathutils.Vector`\n"
|
||||||
" :arg id: An Id object.\n"
|
" :arg id: An Id object.\n"
|
||||||
" :type id: :class:`Id`\n";
|
" :type id: :class:`Id`");
|
||||||
|
|
||||||
//------------------------INSTANCE METHODS ----------------------------------
|
static int SVertex_init(BPy_SVertex *self, PyObject *args, PyObject *kwds)
|
||||||
|
|
||||||
static int SVertex___init__(BPy_SVertex *self, PyObject *args, PyObject *kwds)
|
|
||||||
{
|
{
|
||||||
PyObject *py_point = 0;
|
PyObject *py_point = 0;
|
||||||
BPy_Id *py_id = 0;
|
BPy_Id *py_id = 0;
|
||||||
|
|
||||||
|
|
||||||
if (! PyArg_ParseTuple(args, "|OO!", &py_point, &Id_Type, &py_id) )
|
if (!PyArg_ParseTuple(args, "|OO!", &py_point, &Id_Type, &py_id))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( !py_point ) {
|
if (!py_point) {
|
||||||
self->sv = new SVertex();
|
self->sv = new SVertex();
|
||||||
|
|
||||||
} else if( !py_id && BPy_SVertex_Check(py_point) ) {
|
} else if (!py_id && BPy_SVertex_Check(py_point)) {
|
||||||
self->sv = new SVertex( *(((BPy_SVertex *)py_point)->sv) );
|
self->sv = new SVertex( *(((BPy_SVertex *)py_point)->sv) );
|
||||||
|
|
||||||
} else if( py_point && py_id ) {
|
} else if (py_point && py_id) {
|
||||||
Vec3r *v = Vec3r_ptr_from_PyObject(py_point);
|
Vec3r *v = Vec3r_ptr_from_PyObject(py_point);
|
||||||
if( !v ) {
|
if (!v) {
|
||||||
PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
|
PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
self->sv = new SVertex( *v, *(py_id->id) );
|
self->sv = new SVertex(*v, *(py_id->id));
|
||||||
delete v;
|
delete v;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -68,192 +67,310 @@ static int SVertex___init__(BPy_SVertex *self, PyObject *args, PyObject *kwds)
|
|||||||
|
|
||||||
self->py_if0D.if0D = self->sv;
|
self->py_if0D.if0D = self->sv;
|
||||||
self->py_if0D.borrowed = 0;
|
self->py_if0D.borrowed = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char SVertex_normals___doc__[] =
|
PyDoc_STRVAR(SVertex_add_normal_doc,
|
||||||
".. method:: normals()\n"
|
".. method:: add_normal(n)\n"
|
||||||
"\n"
|
|
||||||
" Returns the normals for this Vertex as a list. In a smooth surface,\n"
|
|
||||||
" a vertex has exactly one normal. In a sharp surface, a vertex can\n"
|
|
||||||
" have any number of normals.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: A list of normals.\n"
|
|
||||||
" :rtype: List of :class:`mathutils.Vector` objects\n";
|
|
||||||
|
|
||||||
static PyObject * SVertex_normals( BPy_SVertex *self ) {
|
|
||||||
PyObject *py_normals;
|
|
||||||
set< Vec3r > normals;
|
|
||||||
|
|
||||||
py_normals = PyList_New(0);
|
|
||||||
normals = self->sv->normals();
|
|
||||||
|
|
||||||
for( set< Vec3r >::iterator set_iterator = normals.begin(); set_iterator != normals.end(); set_iterator++ ) {
|
|
||||||
Vec3r v( *set_iterator );
|
|
||||||
PyList_Append( py_normals, Vector_from_Vec3r(v) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return py_normals;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char SVertex_normalsSize___doc__[] =
|
|
||||||
".. method:: normalsSize()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the number of different normals for this vertex.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The number of normals.\n"
|
|
||||||
" :rtype: int\n";
|
|
||||||
|
|
||||||
static PyObject * SVertex_normalsSize( BPy_SVertex *self ) {
|
|
||||||
return PyLong_FromLong( self->sv->normalsSize() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char SVertex_viewvertex___doc__[] =
|
|
||||||
".. method:: viewvertex()\n"
|
|
||||||
"\n"
|
|
||||||
" If this SVertex is also a ViewVertex, this method returns the\n"
|
|
||||||
" ViewVertex. None is returned otherwise.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The ViewVertex object.\n"
|
|
||||||
" :rtype: :class:`ViewVertex`\n";
|
|
||||||
|
|
||||||
static PyObject * SVertex_viewvertex( BPy_SVertex *self ) {
|
|
||||||
ViewVertex *vv = self->sv->viewvertex();
|
|
||||||
if( vv )
|
|
||||||
return Any_BPy_ViewVertex_from_ViewVertex( *vv );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char SVertex_setPoint3D___doc__[] =
|
|
||||||
".. method:: setPoint3D(p)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the 3D coordinates of the SVertex.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg p: A three-dimensional vector.\n"
|
|
||||||
" :type p: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n";
|
|
||||||
|
|
||||||
static PyObject *SVertex_setPoint3D( BPy_SVertex *self , PyObject *args) {
|
|
||||||
PyObject *py_point;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O", &py_point) ))
|
|
||||||
return NULL;
|
|
||||||
Vec3r *v = Vec3r_ptr_from_PyObject(py_point);
|
|
||||||
if( !v ) {
|
|
||||||
PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
self->sv->setPoint3D( *v );
|
|
||||||
delete v;
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char SVertex_setPoint2D___doc__[] =
|
|
||||||
".. method:: setPoint2D(p)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the 2D projected coordinates of the SVertex.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg p: A three-dimensional vector.\n"
|
|
||||||
" :type p: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n";
|
|
||||||
|
|
||||||
static PyObject *SVertex_setPoint2D( BPy_SVertex *self , PyObject *args) {
|
|
||||||
PyObject *py_point;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O", &py_point) ))
|
|
||||||
return NULL;
|
|
||||||
Vec3r *v = Vec3r_ptr_from_PyObject(py_point);
|
|
||||||
if( !v ) {
|
|
||||||
PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
self->sv->setPoint2D( *v );
|
|
||||||
delete v;
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char SVertex_AddNormal___doc__[] =
|
|
||||||
".. method:: AddNormal(n)\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
" Adds a normal to the SVertex's set of normals. If the same normal\n"
|
" Adds a normal to the SVertex's set of normals. If the same normal\n"
|
||||||
" is already in the set, nothing changes.\n"
|
" is already in the set, nothing changes.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg n: A three-dimensional vector.\n"
|
" :arg n: A three-dimensional vector.\n"
|
||||||
" :type n: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n";
|
" :type n: :class:`mathutils.Vector`, list or tuple of 3 real numbers");
|
||||||
|
|
||||||
static PyObject *SVertex_AddNormal( BPy_SVertex *self , PyObject *args) {
|
static PyObject *SVertex_add_normal( BPy_SVertex *self , PyObject *args) {
|
||||||
PyObject *py_normal;
|
PyObject *py_normal;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O", &py_normal) ))
|
if (!PyArg_ParseTuple(args, "O", &py_normal))
|
||||||
return NULL;
|
return NULL;
|
||||||
Vec3r *n = Vec3r_ptr_from_PyObject(py_normal);
|
Vec3r *n = Vec3r_ptr_from_PyObject(py_normal);
|
||||||
if( !n ) {
|
if (!n) {
|
||||||
PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
|
PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
self->sv->AddNormal( *n );
|
self->sv->AddNormal(*n);
|
||||||
delete n;
|
delete n;
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char SVertex_setId___doc__[] =
|
PyDoc_STRVAR(SVertex_add_fedge_doc,
|
||||||
".. method:: setId(id)\n"
|
".. method:: add_fedge(fe)\n"
|
||||||
"\n"
|
|
||||||
" Sets the identifier of the SVertex.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg id: The identifier.\n"
|
|
||||||
" :type id: :class:`Id`\n";
|
|
||||||
|
|
||||||
static PyObject *SVertex_setId( BPy_SVertex *self , PyObject *args) {
|
|
||||||
BPy_Id *py_id;
|
|
||||||
|
|
||||||
if( !PyArg_ParseTuple(args, "O!", &Id_Type, &py_id) )
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->sv->setId( *(py_id->id) );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char SVertex_AddFEdge___doc__[] =
|
|
||||||
".. method:: AddFEdge(fe)\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
" Add an FEdge to the list of edges emanating from this SVertex.\n"
|
" Add an FEdge to the list of edges emanating from this SVertex.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg fe: An FEdge.\n"
|
" :arg fe: An FEdge.\n"
|
||||||
" :type fe: :class:`FEdge`\n";
|
" :type fe: :class:`FEdge`");
|
||||||
|
|
||||||
static PyObject *SVertex_AddFEdge( BPy_SVertex *self , PyObject *args) {
|
static PyObject *SVertex_add_fedge( BPy_SVertex *self , PyObject *args) {
|
||||||
PyObject *py_fe;
|
PyObject *py_fe;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe) ))
|
if (!PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
self->sv->AddFEdge( ((BPy_FEdge *) py_fe)->fe );
|
self->sv->AddFEdge(((BPy_FEdge *)py_fe)->fe);
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char SVertex_curvatures___doc__[] =
|
// virtual bool operator== (const SVertex &iBrother)
|
||||||
".. method:: curvatures()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns curvature information in the form of a seven-element tuple\n"
|
|
||||||
" (K1, e1, K2, e2, Kr, er, dKr), where K1 and K2 are scalar values\n"
|
|
||||||
" representing the first (maximum) and second (minimum) principal\n"
|
|
||||||
" curvatures at this SVertex, respectively; e1 and e2 are\n"
|
|
||||||
" three-dimensional vectors representing the first and second principal\n"
|
|
||||||
" directions, i.e. the directions of the normal plane where the\n"
|
|
||||||
" curvature takes its maximum and minimum values, respectively; and Kr,\n"
|
|
||||||
" er and dKr are the radial curvature, radial direction, and the\n"
|
|
||||||
" derivative of the radial curvature at this SVertex, repectively.\n"
|
|
||||||
" :return: curvature information expressed by a seven-element tuple\n"
|
|
||||||
" (K1, e1, K2, e2, Kr, er, dKr).\n"
|
|
||||||
" :rtype: tuple\n";
|
|
||||||
|
|
||||||
static PyObject *SVertex_curvatures( BPy_SVertex *self , PyObject *args) {
|
static PyMethodDef BPy_SVertex_methods[] = {
|
||||||
|
{"add_normal", (PyCFunction)SVertex_add_normal, METH_VARARGS, SVertex_add_normal_doc},
|
||||||
|
{"add_fedge", (PyCFunction)SVertex_add_fedge, METH_VARARGS, SVertex_add_fedge_doc},
|
||||||
|
{NULL, NULL, 0, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*----------------------mathutils callbacks ----------------------------*/
|
||||||
|
|
||||||
|
/* subtype */
|
||||||
|
#define MATHUTILS_SUBTYPE_POINT3D 1
|
||||||
|
#define MATHUTILS_SUBTYPE_POINT2D 2
|
||||||
|
|
||||||
|
static int SVertex_mathutils_check(BaseMathObject *bmo)
|
||||||
|
{
|
||||||
|
if (!BPy_SVertex_Check(bmo->cb_user))
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int SVertex_mathutils_get(BaseMathObject *bmo, int subtype)
|
||||||
|
{
|
||||||
|
BPy_SVertex *self = (BPy_SVertex *)bmo->cb_user;
|
||||||
|
switch (subtype) {
|
||||||
|
case MATHUTILS_SUBTYPE_POINT3D:
|
||||||
|
bmo->data[0] = self->sv->getX();
|
||||||
|
bmo->data[1] = self->sv->getY();
|
||||||
|
bmo->data[2] = self->sv->getZ();
|
||||||
|
break;
|
||||||
|
case MATHUTILS_SUBTYPE_POINT2D:
|
||||||
|
bmo->data[0] = self->sv->getProjectedX();
|
||||||
|
bmo->data[1] = self->sv->getProjectedY();
|
||||||
|
bmo->data[2] = self->sv->getProjectedZ();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int SVertex_mathutils_set(BaseMathObject *bmo, int subtype)
|
||||||
|
{
|
||||||
|
BPy_SVertex *self = (BPy_SVertex *)bmo->cb_user;
|
||||||
|
switch (subtype) {
|
||||||
|
case MATHUTILS_SUBTYPE_POINT3D:
|
||||||
|
{
|
||||||
|
Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
|
||||||
|
self->sv->setPoint3D(p);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MATHUTILS_SUBTYPE_POINT2D:
|
||||||
|
{
|
||||||
|
Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
|
||||||
|
self->sv->setPoint2D(p);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int SVertex_mathutils_get_index(BaseMathObject *bmo, int subtype, int index)
|
||||||
|
{
|
||||||
|
BPy_SVertex *self = (BPy_SVertex *)bmo->cb_user;
|
||||||
|
switch (subtype) {
|
||||||
|
case MATHUTILS_SUBTYPE_POINT3D:
|
||||||
|
switch (index) {
|
||||||
|
case 0: bmo->data[0] = self->sv->getX(); break;
|
||||||
|
case 1: bmo->data[1] = self->sv->getY(); break;
|
||||||
|
case 2: bmo->data[2] = self->sv->getZ(); break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MATHUTILS_SUBTYPE_POINT2D:
|
||||||
|
switch (index) {
|
||||||
|
case 0: bmo->data[0] = self->sv->getProjectedX(); break;
|
||||||
|
case 1: bmo->data[1] = self->sv->getProjectedY(); break;
|
||||||
|
case 2: bmo->data[2] = self->sv->getProjectedZ(); break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int SVertex_mathutils_set_index(BaseMathObject *bmo, int subtype, int index)
|
||||||
|
{
|
||||||
|
BPy_SVertex *self = (BPy_SVertex *)bmo->cb_user;
|
||||||
|
switch (subtype) {
|
||||||
|
case MATHUTILS_SUBTYPE_POINT3D:
|
||||||
|
{
|
||||||
|
Vec3r p(self->sv->point3D());
|
||||||
|
p[index] = bmo->data[index];
|
||||||
|
self->sv->setPoint3D(p);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MATHUTILS_SUBTYPE_POINT2D:
|
||||||
|
{
|
||||||
|
Vec3r p(self->sv->point2D());
|
||||||
|
p[index] = bmo->data[index];
|
||||||
|
self->sv->setPoint2D(p);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Mathutils_Callback SVertex_mathutils_cb = {
|
||||||
|
SVertex_mathutils_check,
|
||||||
|
SVertex_mathutils_get,
|
||||||
|
SVertex_mathutils_set,
|
||||||
|
SVertex_mathutils_get_index,
|
||||||
|
SVertex_mathutils_set_index
|
||||||
|
};
|
||||||
|
|
||||||
|
static unsigned char SVertex_mathutils_cb_index = -1;
|
||||||
|
|
||||||
|
void SVertex_mathutils_register_callback()
|
||||||
|
{
|
||||||
|
SVertex_mathutils_cb_index = Mathutils_RegisterCallback(&SVertex_mathutils_cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*----------------------SVertex get/setters ----------------------------*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(SVertex_point_3d_doc,
|
||||||
|
"The 3D coordinates of the SVertex.\n"
|
||||||
|
"\n"
|
||||||
|
":type: mathutils.Vector");
|
||||||
|
|
||||||
|
static PyObject *SVertex_point_3d_get(BPy_SVertex *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return Vector_CreatePyObject_cb((PyObject *)self, 3, SVertex_mathutils_cb_index, MATHUTILS_SUBTYPE_POINT3D);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int SVertex_point_3d_set(BPy_SVertex *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
float v[3];
|
||||||
|
if (!float_array_from_PyObject(value, v, 3)) {
|
||||||
|
PyErr_SetString(PyExc_ValueError, "value must be a 3-dimensional vector");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
Vec3r p(v[0], v[1], v[2]);
|
||||||
|
self->sv->setPoint3D(p);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(SVertex_point_2d_doc,
|
||||||
|
"The projected 3D coordinates of the SVertex.\n"
|
||||||
|
"\n"
|
||||||
|
":type: mathutils.Vector");
|
||||||
|
|
||||||
|
static PyObject *SVertex_point_2d_get(BPy_SVertex *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return Vector_CreatePyObject_cb((PyObject *)self, 3, SVertex_mathutils_cb_index, MATHUTILS_SUBTYPE_POINT2D);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int SVertex_point_2d_set(BPy_SVertex *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
float v[3];
|
||||||
|
if (!float_array_from_PyObject(value, v, 3)) {
|
||||||
|
PyErr_SetString(PyExc_ValueError, "value must be a 3-dimensional vector");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
Vec3r p(v[0], v[1], v[2]);
|
||||||
|
self->sv->setPoint2D(p);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(SVertex_id_doc,
|
||||||
|
"The Id of this SVertex.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`Id`");
|
||||||
|
|
||||||
|
static PyObject *SVertex_id_get(BPy_SVertex *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
Id id(self->sv->getId());
|
||||||
|
return BPy_Id_from_Id(id); // return a copy
|
||||||
|
}
|
||||||
|
|
||||||
|
static int SVertex_id_set(BPy_SVertex *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!BPy_Id_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be an Id");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->sv->setId(*(((BPy_Id *)value)->id));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(SVertex_normals_doc,
|
||||||
|
"The normals for this Vertex as a list. In a sharp surface, an SVertex\n"
|
||||||
|
"has exactly one normal. In a smooth surface, an SVertex can have any\n"
|
||||||
|
"number of normals.\n"
|
||||||
|
"\n"
|
||||||
|
":type: list of :class:`mathutils.Vector` objects");
|
||||||
|
|
||||||
|
static PyObject *SVertex_normals_get(BPy_SVertex *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
PyObject *py_normals;
|
||||||
|
set< Vec3r > normals;
|
||||||
|
|
||||||
|
py_normals = PyList_New(0);
|
||||||
|
normals = self->sv->normals();
|
||||||
|
for (set< Vec3r >::iterator set_iterator = normals.begin(); set_iterator != normals.end(); set_iterator++) {
|
||||||
|
Vec3r v(*set_iterator);
|
||||||
|
PyList_Append(py_normals, Vector_from_Vec3r(v));
|
||||||
|
}
|
||||||
|
return py_normals;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(SVertex_normals_size_doc,
|
||||||
|
"The number of different normals for this SVertex.\n"
|
||||||
|
"\n"
|
||||||
|
":type: int");
|
||||||
|
|
||||||
|
static PyObject *SVertex_normals_size_get(BPy_SVertex *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyLong_FromLong(self->sv->normalsSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(SVertex_viewvertex_doc,
|
||||||
|
"If this SVertex is also a ViewVertex, this property refers to the\n"
|
||||||
|
"ViewVertex, and None otherwise.\n"
|
||||||
|
":type: :class:`ViewVertex`");
|
||||||
|
|
||||||
|
static PyObject *SVertex_viewvertex_get(BPy_SVertex *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
ViewVertex *vv = self->sv->viewvertex();
|
||||||
|
if (vv)
|
||||||
|
return Any_BPy_ViewVertex_from_ViewVertex(*vv);
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(SVertex_curvatures_doc,
|
||||||
|
"Curvature information expressed in the form of a seven-element tuple\n"
|
||||||
|
"(K1, e1, K2, e2, Kr, er, dKr), where K1 and K2 are scalar values\n"
|
||||||
|
"representing the first (maximum) and second (minimum) principal\n"
|
||||||
|
"curvatures at this SVertex, respectively; e1 and e2 are\n"
|
||||||
|
"three-dimensional vectors representing the first and second principal\n"
|
||||||
|
"directions, i.e. the directions of the normal plane where the\n"
|
||||||
|
"curvature takes its maximum and minimum values, respectively; and Kr,\n"
|
||||||
|
"er and dKr are the radial curvature, radial direction, and the\n"
|
||||||
|
"derivative of the radial curvature at this SVertex, repectively.\n"
|
||||||
|
"\n"
|
||||||
|
":type: tuple");
|
||||||
|
|
||||||
|
static PyObject *SVertex_curvatures_get(BPy_SVertex *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
const CurvatureInfo *info = self->sv->getCurvatureInfo();
|
const CurvatureInfo *info = self->sv->getCurvatureInfo();
|
||||||
if (!info)
|
if (!info)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
@@ -261,31 +378,25 @@ static PyObject *SVertex_curvatures( BPy_SVertex *self , PyObject *args) {
|
|||||||
Vec3r e2(info->e2.x(), info->e2.y(), info->e2.z());
|
Vec3r e2(info->e2.x(), info->e2.y(), info->e2.z());
|
||||||
Vec3r er(info->er.x(), info->er.y(), info->er.z());
|
Vec3r er(info->er.x(), info->er.y(), info->er.z());
|
||||||
PyObject *retval = PyTuple_New(7);
|
PyObject *retval = PyTuple_New(7);
|
||||||
PyTuple_SET_ITEM( retval, 0, PyFloat_FromDouble(info->K1));
|
PyTuple_SET_ITEM(retval, 0, PyFloat_FromDouble(info->K1));
|
||||||
PyTuple_SET_ITEM( retval, 2, Vector_from_Vec3r(e1));
|
PyTuple_SET_ITEM(retval, 2, Vector_from_Vec3r(e1));
|
||||||
PyTuple_SET_ITEM( retval, 1, PyFloat_FromDouble(info->K2));
|
PyTuple_SET_ITEM(retval, 1, PyFloat_FromDouble(info->K2));
|
||||||
PyTuple_SET_ITEM( retval, 3, Vector_from_Vec3r(e2));
|
PyTuple_SET_ITEM(retval, 3, Vector_from_Vec3r(e2));
|
||||||
PyTuple_SET_ITEM( retval, 4, PyFloat_FromDouble(info->Kr));
|
PyTuple_SET_ITEM(retval, 4, PyFloat_FromDouble(info->Kr));
|
||||||
PyTuple_SET_ITEM( retval, 5, Vector_from_Vec3r(er));
|
PyTuple_SET_ITEM(retval, 5, Vector_from_Vec3r(er));
|
||||||
PyTuple_SET_ITEM( retval, 6, PyFloat_FromDouble(info->dKr));
|
PyTuple_SET_ITEM(retval, 6, PyFloat_FromDouble(info->dKr));
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
// virtual bool operator== (const SVertex &iBrother)
|
static PyGetSetDef BPy_SVertex_getseters[] = {
|
||||||
// ViewVertex * viewvertex ()
|
{(char *)"point_3d", (getter)SVertex_point_3d_get, (setter)SVertex_point_3d_set, (char *)SVertex_point_3d_doc, NULL},
|
||||||
|
{(char *)"point_2d", (getter)SVertex_point_2d_get, (setter)SVertex_point_2d_set, (char *)SVertex_point_2d_doc, NULL},
|
||||||
/*----------------------SVertex instance definitions ----------------------------*/
|
{(char *)"id", (getter)SVertex_id_get, (setter)SVertex_id_set, (char *)SVertex_id_doc, NULL},
|
||||||
static PyMethodDef BPy_SVertex_methods[] = {
|
{(char *)"normals", (getter)SVertex_normals_get, (setter)NULL, (char *)SVertex_normals_doc, NULL},
|
||||||
{"normals", ( PyCFunction ) SVertex_normals, METH_NOARGS, SVertex_normals___doc__},
|
{(char *)"normals_size", (getter)SVertex_normals_size_get, (setter)NULL, (char *)SVertex_normals_size_doc, NULL},
|
||||||
{"normalsSize", ( PyCFunction ) SVertex_normalsSize, METH_NOARGS, SVertex_normalsSize___doc__},
|
{(char *)"viewvertex", (getter)SVertex_viewvertex_get, (setter)NULL, (char *)SVertex_viewvertex_doc, NULL},
|
||||||
{"viewvertex", ( PyCFunction ) SVertex_viewvertex, METH_NOARGS, SVertex_viewvertex___doc__},
|
{(char *)"curvatures", (getter)SVertex_curvatures_get, (setter)NULL, (char *)SVertex_curvatures_doc, NULL},
|
||||||
{"setPoint3D", ( PyCFunction ) SVertex_setPoint3D, METH_VARARGS, SVertex_setPoint3D___doc__},
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||||
{"setPoint2D", ( PyCFunction ) SVertex_setPoint2D, METH_VARARGS, SVertex_setPoint2D___doc__},
|
|
||||||
{"AddNormal", ( PyCFunction ) SVertex_AddNormal, METH_VARARGS, SVertex_AddNormal___doc__},
|
|
||||||
{"setId", ( PyCFunction ) SVertex_setId, METH_VARARGS, SVertex_setId___doc__},
|
|
||||||
{"AddFEdge", ( PyCFunction ) SVertex_AddFEdge, METH_VARARGS, SVertex_AddFEdge___doc__},
|
|
||||||
{"curvatures", ( PyCFunction ) SVertex_curvatures, METH_NOARGS, SVertex_curvatures___doc__},
|
|
||||||
{NULL, NULL, 0, NULL}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-----------------------BPy_SVertex type definition ------------------------------*/
|
/*-----------------------BPy_SVertex type definition ------------------------------*/
|
||||||
@@ -310,7 +421,7 @@ PyTypeObject SVertex_Type = {
|
|||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
SVertex___doc__, /* tp_doc */
|
SVertex_doc, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
@@ -319,13 +430,13 @@ PyTypeObject SVertex_Type = {
|
|||||||
0, /* tp_iternext */
|
0, /* tp_iternext */
|
||||||
BPy_SVertex_methods, /* tp_methods */
|
BPy_SVertex_methods, /* tp_methods */
|
||||||
0, /* tp_members */
|
0, /* tp_members */
|
||||||
0, /* tp_getset */
|
BPy_SVertex_getseters, /* tp_getset */
|
||||||
&Interface0D_Type, /* tp_base */
|
&Interface0D_Type, /* tp_base */
|
||||||
0, /* tp_dict */
|
0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
(initproc)SVertex___init__, /* tp_init */
|
(initproc)SVertex_init, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
0, /* tp_new */
|
0, /* tp_new */
|
||||||
};
|
};
|
||||||
@@ -335,4 +446,3 @@ PyTypeObject SVertex_Type = {
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ typedef struct {
|
|||||||
SVertex *sv;
|
SVertex *sv;
|
||||||
} BPy_SVertex;
|
} BPy_SVertex;
|
||||||
|
|
||||||
|
/*---------------------------Python BPy_SVertex visible prototypes-----------*/
|
||||||
|
|
||||||
|
void SVertex_mathutils_register_callback();
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ extern "C" {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//------------------------INSTANCE METHODS ----------------------------------
|
/*----------------------ViewVertex methods----------------------------*/
|
||||||
|
|
||||||
static char ViewVertex___doc__[] =
|
PyDoc_STRVAR(ViewVertex_doc,
|
||||||
"Class hierarchy: :class:`Interface0D` > :class:`ViewVertex`\n"
|
"Class hierarchy: :class:`Interface0D` > :class:`ViewVertex`\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Class to define a view vertex. A view vertex is a feature vertex\n"
|
"Class to define a view vertex. A view vertex is a feature vertex\n"
|
||||||
@@ -34,43 +34,20 @@ static char ViewVertex___doc__[] =
|
|||||||
" Copy constructor.\n"
|
" Copy constructor.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg iBrother: A ViewVertex object.\n"
|
" :arg iBrother: A ViewVertex object.\n"
|
||||||
" :type iBrother: :class:`ViewVertex`\n";
|
" :type iBrother: :class:`ViewVertex`");
|
||||||
|
|
||||||
static int ViewVertex___init__( BPy_ViewVertex *self, PyObject *args, PyObject *kwds )
|
static int ViewVertex_init(BPy_ViewVertex *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
if( !PyArg_ParseTuple(args, "") )
|
if (!PyArg_ParseTuple(args, ""))
|
||||||
return -1;
|
return -1;
|
||||||
self->vv = 0; // ViewVertex is abstract
|
self->vv = 0; // ViewVertex is abstract
|
||||||
self->py_if0D.if0D = self->vv;
|
self->py_if0D.if0D = self->vv;
|
||||||
self->py_if0D.borrowed = 0;
|
self->py_if0D.borrowed = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char ViewVertex_setNature___doc__[] =
|
PyDoc_STRVAR(ViewVertex_edges_begin_doc,
|
||||||
".. method:: setNature(iNature)\n"
|
".. method:: edges_begin()\n"
|
||||||
"\n"
|
|
||||||
" Sets the nature of the vertex.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iNature: A Nature object.\n"
|
|
||||||
" :type iNature: :class:`Nature`\n";
|
|
||||||
|
|
||||||
static PyObject * ViewVertex_setNature( BPy_ViewVertex *self, PyObject *args ) {
|
|
||||||
PyObject *py_n;
|
|
||||||
|
|
||||||
if( !self->vv )
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &Nature_Type, &py_n) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
PyObject *i = (PyObject *) &( ((BPy_Nature *) py_n)->i );
|
|
||||||
((ViewVertex *) self->py_if0D.if0D)->setNature( PyLong_AsLong(i) );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewVertex_edgesBegin___doc__[] =
|
|
||||||
".. method:: edgesBegin()\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
" Returns an iterator over the ViewEdges that goes to or comes from\n"
|
" Returns an iterator over the ViewEdges that goes to or comes from\n"
|
||||||
" this ViewVertex pointing to the first ViewEdge of the list. The\n"
|
" this ViewVertex pointing to the first ViewEdge of the list. The\n"
|
||||||
@@ -79,40 +56,40 @@ static char ViewVertex_edgesBegin___doc__[] =
|
|||||||
" (incoming/outgoing).\n"
|
" (incoming/outgoing).\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :return: An orientedViewEdgeIterator pointing to the first ViewEdge.\n"
|
" :return: An orientedViewEdgeIterator pointing to the first ViewEdge.\n"
|
||||||
" :rtype: :class:`orientedViewEdgeIterator`\n";
|
" :rtype: :class:`orientedViewEdgeIterator`");
|
||||||
|
|
||||||
static PyObject * ViewVertex_edgesBegin( BPy_ViewVertex *self ) {
|
static PyObject * ViewVertex_edges_begin(BPy_ViewVertex *self)
|
||||||
if( !self->vv )
|
{
|
||||||
|
if (!self->vv)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
|
ViewVertexInternal::orientedViewEdgeIterator ove_it(self->vv->edgesBegin());
|
||||||
ViewVertexInternal::orientedViewEdgeIterator ove_it( self->vv->edgesBegin() );
|
return BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator(ove_it, 0);
|
||||||
return BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator( ove_it, 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char ViewVertex_edgesEnd___doc__[] =
|
PyDoc_STRVAR(ViewVertex_edges_end_doc,
|
||||||
".. method:: edgesEnd()\n"
|
".. method:: edges_end()\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Returns an orientedViewEdgeIterator over the ViewEdges around this\n"
|
" Returns an orientedViewEdgeIterator over the ViewEdges around this\n"
|
||||||
" ViewVertex, pointing after the last ViewEdge.\n"
|
" ViewVertex, pointing after the last ViewEdge.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :return: An orientedViewEdgeIterator pointing after the last ViewEdge.\n"
|
" :return: An orientedViewEdgeIterator pointing after the last ViewEdge.\n"
|
||||||
" :rtype: :class:`orientedViewEdgeIterator`\n";
|
" :rtype: :class:`orientedViewEdgeIterator`");
|
||||||
|
|
||||||
static PyObject * ViewVertex_edgesEnd( BPy_ViewVertex *self ) {
|
static PyObject * ViewVertex_edges_end(BPy_ViewVertex *self)
|
||||||
|
{
|
||||||
#if 0
|
#if 0
|
||||||
if( !self->vv )
|
if (!self->vv)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
|
ViewVertexInternal::orientedViewEdgeIterator ove_it(self->vv->edgesEnd());
|
||||||
ViewVertexInternal::orientedViewEdgeIterator ove_it( self->vv->edgesEnd() );
|
return BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator(ove_it, 1);
|
||||||
return BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator( ove_it, 1 );
|
|
||||||
#else
|
#else
|
||||||
PyErr_SetString(PyExc_NotImplementedError, "edgesEnd method currently disabled");
|
PyErr_SetString(PyExc_NotImplementedError, "edges_end method currently disabled");
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static char ViewVertex_edgesIterator___doc__[] =
|
PyDoc_STRVAR(ViewVertex_edges_iterator_doc,
|
||||||
".. method:: edgesIterator(iEdge)\n"
|
".. method:: edges_iterator(iEdge)\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Returns an orientedViewEdgeIterator pointing to the ViewEdge given\n"
|
" Returns an orientedViewEdgeIterator pointing to the ViewEdge given\n"
|
||||||
" as argument.\n"
|
" as argument.\n"
|
||||||
@@ -120,31 +97,58 @@ static char ViewVertex_edgesIterator___doc__[] =
|
|||||||
" :arg iEdge: A ViewEdge object.\n"
|
" :arg iEdge: A ViewEdge object.\n"
|
||||||
" :type iEdge: :class:`ViewEdge`\n"
|
" :type iEdge: :class:`ViewEdge`\n"
|
||||||
" :return: An orientedViewEdgeIterator pointing to the given ViewEdge.\n"
|
" :return: An orientedViewEdgeIterator pointing to the given ViewEdge.\n"
|
||||||
" :rtype: :class:`orientedViewEdgeIterator`\n";
|
" :rtype: :class:`orientedViewEdgeIterator`");
|
||||||
|
|
||||||
static PyObject * ViewVertex_edgesIterator( BPy_ViewVertex *self, PyObject *args ) {
|
static PyObject * ViewVertex_edges_iterator(BPy_ViewVertex *self, PyObject *args)
|
||||||
|
{
|
||||||
PyObject *py_ve;
|
PyObject *py_ve;
|
||||||
|
|
||||||
if( !self->vv )
|
if (!self->vv)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
|
if (!PyArg_ParseTuple(args, "O!", &ViewEdge_Type, &py_ve))
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &ViewEdge_Type, &py_ve) ))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
ViewEdge *ve = ((BPy_ViewEdge *)py_ve)->ve;
|
||||||
ViewEdge *ve = ((BPy_ViewEdge *) py_ve)->ve;
|
ViewVertexInternal::orientedViewEdgeIterator ove_it(self->vv->edgesIterator(ve));
|
||||||
ViewVertexInternal::orientedViewEdgeIterator ove_it( self->vv->edgesIterator( ve ) );
|
return BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator(ove_it, 0);
|
||||||
return BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator( ove_it, 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------ViewVertex instance definitions ----------------------------*/
|
|
||||||
static PyMethodDef BPy_ViewVertex_methods[] = {
|
static PyMethodDef BPy_ViewVertex_methods[] = {
|
||||||
{"setNature", ( PyCFunction ) ViewVertex_setNature, METH_VARARGS, ViewVertex_setNature___doc__},
|
{"edges_begin", (PyCFunction)ViewVertex_edges_begin, METH_NOARGS, ViewVertex_edges_begin_doc},
|
||||||
{"edgesBegin", ( PyCFunction ) ViewVertex_edgesBegin, METH_NOARGS, ViewVertex_edgesBegin___doc__},
|
{"edges_end", (PyCFunction)ViewVertex_edges_end, METH_NOARGS, ViewVertex_edges_end_doc},
|
||||||
{"edgesEnd", ( PyCFunction ) ViewVertex_edgesEnd, METH_NOARGS, ViewVertex_edgesEnd___doc__},
|
{"edges_iterator", (PyCFunction)ViewVertex_edges_iterator, METH_VARARGS, ViewVertex_edges_iterator_doc},
|
||||||
{"edgesIterator", ( PyCFunction ) ViewVertex_edgesIterator, METH_VARARGS, ViewVertex_edgesIterator___doc__},
|
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*----------------------ViewVertex get/setters ----------------------------*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(ViewVertex_nature_doc,
|
||||||
|
"The nature of this ViewVertex.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`Nature`");
|
||||||
|
|
||||||
|
static PyObject *ViewVertex_nature_get(BPy_ViewVertex *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
Nature::VertexNature nature = self->vv->getNature();
|
||||||
|
if (PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
|
return BPy_Nature_from_Nature(nature); // return a copy
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ViewVertex_nature_set(BPy_ViewVertex *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!BPy_Nature_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be a Nature");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->vv->setNature(PyLong_AsLong((PyObject *)&((BPy_Nature *)value)->i));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyGetSetDef BPy_ViewVertex_getseters[] = {
|
||||||
|
{(char *)"nature", (getter)ViewVertex_nature_get, (setter)ViewVertex_nature_set, (char *)ViewVertex_nature_doc, NULL},
|
||||||
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||||
|
};
|
||||||
|
|
||||||
/*-----------------------BPy_ViewVertex type definition ------------------------------*/
|
/*-----------------------BPy_ViewVertex type definition ------------------------------*/
|
||||||
PyTypeObject ViewVertex_Type = {
|
PyTypeObject ViewVertex_Type = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
@@ -167,7 +171,7 @@ PyTypeObject ViewVertex_Type = {
|
|||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
ViewVertex___doc__, /* tp_doc */
|
ViewVertex_doc, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
@@ -176,13 +180,13 @@ PyTypeObject ViewVertex_Type = {
|
|||||||
0, /* tp_iternext */
|
0, /* tp_iternext */
|
||||||
BPy_ViewVertex_methods, /* tp_methods */
|
BPy_ViewVertex_methods, /* tp_methods */
|
||||||
0, /* tp_members */
|
0, /* tp_members */
|
||||||
0, /* tp_getset */
|
BPy_ViewVertex_getseters, /* tp_getset */
|
||||||
&Interface0D_Type, /* tp_base */
|
&Interface0D_Type, /* tp_base */
|
||||||
0, /* tp_dict */
|
0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
(initproc)ViewVertex___init__, /* tp_init */
|
(initproc)ViewVertex_init, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
0, /* tp_new */
|
0, /* tp_new */
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ extern "C" {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//------------------------INSTANCE METHODS ----------------------------------
|
/*----------------------NonTVertex methods ----------------------------*/
|
||||||
|
|
||||||
static char NonTVertex___doc__[] =
|
PyDoc_STRVAR(NonTVertex_doc,
|
||||||
"Class hierarchy: :class:`Interface0D` > :class:`ViewVertex` > :class:`NonTVertex`\n"
|
"Class hierarchy: :class:`Interface0D` > :class:`ViewVertex` > :class:`NonTVertex`\n"
|
||||||
"\n"
|
"\n"
|
||||||
"View vertex for corners, cusps, etc. associated to a single SVertex.\n"
|
"View vertex for corners, cusps, etc. associated to a single SVertex.\n"
|
||||||
@@ -33,21 +33,20 @@ static char NonTVertex___doc__[] =
|
|||||||
" Builds a NonTVertex from a SVertex.\n"
|
" Builds a NonTVertex from a SVertex.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg iSVertex: An SVertex object.\n"
|
" :arg iSVertex: An SVertex object.\n"
|
||||||
" :type iSVertex: :class:`SVertex`\n";
|
" :type iSVertex: :class:`SVertex`");
|
||||||
|
|
||||||
static int NonTVertex___init__(BPy_NonTVertex *self, PyObject *args, PyObject *kwds)
|
static int NonTVertex_init(BPy_NonTVertex *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
|
|
||||||
PyObject *obj = 0;
|
PyObject *obj = 0;
|
||||||
|
|
||||||
if (! PyArg_ParseTuple(args, "|O!", &SVertex_Type, &obj) )
|
if (!PyArg_ParseTuple(args, "|O!", &SVertex_Type, &obj))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( !obj ){
|
if (!obj) {
|
||||||
self->ntv = new NonTVertex();
|
self->ntv = new NonTVertex();
|
||||||
|
|
||||||
} else if( ((BPy_SVertex *) obj)->sv ) {
|
} else if(((BPy_SVertex *)obj)->sv) {
|
||||||
self->ntv = new NonTVertex( ((BPy_SVertex *) obj)->sv );
|
self->ntv = new NonTVertex(((BPy_SVertex *)obj)->sv);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError, "invalid argument");
|
PyErr_SetString(PyExc_TypeError, "invalid argument");
|
||||||
@@ -61,49 +60,40 @@ static int NonTVertex___init__(BPy_NonTVertex *self, PyObject *args, PyObject *k
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char NonTVertex_svertex___doc__[] =
|
|
||||||
".. method:: svertex()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the SVertex on top of which this NonTVertex is built.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The SVertex on top of which this NonTVertex is built.\n"
|
|
||||||
" :rtype: :class:`SVertex`\n";
|
|
||||||
|
|
||||||
static PyObject * NonTVertex_svertex( BPy_NonTVertex *self ) {
|
|
||||||
SVertex *v = self->ntv->svertex();
|
|
||||||
if( v ){
|
|
||||||
return BPy_SVertex_from_SVertex( *v );
|
|
||||||
}
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char NonTVertex_setSVertex___doc__[] =
|
|
||||||
".. method:: setSVertex(iSVertex)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the SVertex on top of which this NonTVertex is built.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iSVertex: The SVertex on top of which this NonTVertex is built.\n"
|
|
||||||
" :type iSVertex: :class:`SVertex`\n";
|
|
||||||
|
|
||||||
static PyObject * NonTVertex_setSVertex( BPy_NonTVertex *self, PyObject *args) {
|
|
||||||
PyObject *py_sv;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &SVertex_Type, &py_sv) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->ntv->setSVertex( ((BPy_SVertex *) py_sv)->sv );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*----------------------NonTVertex instance definitions ----------------------------*/
|
|
||||||
static PyMethodDef BPy_NonTVertex_methods[] = {
|
static PyMethodDef BPy_NonTVertex_methods[] = {
|
||||||
{"svertex", ( PyCFunction ) NonTVertex_svertex, METH_NOARGS, NonTVertex_svertex___doc__},
|
|
||||||
{"setSVertex", ( PyCFunction ) NonTVertex_setSVertex, METH_VARARGS, NonTVertex_setSVertex___doc__},
|
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*----------------------NonTVertex get/setters ----------------------------*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(NonTVertex_svertex_doc,
|
||||||
|
"The SVertex on top of which this NonTVertex is built.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`SVertex`");
|
||||||
|
|
||||||
|
static PyObject *NonTVertex_svertex_get(BPy_NonTVertex *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
SVertex *v = self->ntv->svertex();
|
||||||
|
if (v)
|
||||||
|
return BPy_SVertex_from_SVertex(*v);
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int NonTVertex_svertex_set(BPy_NonTVertex *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!BPy_SVertex_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be an SVertex");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->ntv->setSVertex(((BPy_SVertex *)value)->sv);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyGetSetDef BPy_NonTVertex_getseters[] = {
|
||||||
|
{(char *)"svertex", (getter)NonTVertex_svertex_get, (setter)NonTVertex_svertex_set, (char *)NonTVertex_svertex_doc, NULL},
|
||||||
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||||
|
};
|
||||||
|
|
||||||
/*-----------------------BPy_NonTVertex type definition ------------------------------*/
|
/*-----------------------BPy_NonTVertex type definition ------------------------------*/
|
||||||
PyTypeObject NonTVertex_Type = {
|
PyTypeObject NonTVertex_Type = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
@@ -126,7 +116,7 @@ PyTypeObject NonTVertex_Type = {
|
|||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
NonTVertex___doc__, /* tp_doc */
|
NonTVertex_doc, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
@@ -135,13 +125,13 @@ PyTypeObject NonTVertex_Type = {
|
|||||||
0, /* tp_iternext */
|
0, /* tp_iternext */
|
||||||
BPy_NonTVertex_methods, /* tp_methods */
|
BPy_NonTVertex_methods, /* tp_methods */
|
||||||
0, /* tp_members */
|
0, /* tp_members */
|
||||||
0, /* tp_getset */
|
BPy_NonTVertex_getseters, /* tp_getset */
|
||||||
&ViewVertex_Type, /* tp_base */
|
&ViewVertex_Type, /* tp_base */
|
||||||
0, /* tp_dict */
|
0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
(initproc)NonTVertex___init__, /* tp_init */
|
(initproc)NonTVertex_init, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
0, /* tp_new */
|
0, /* tp_new */
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ extern "C" {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//------------------------INSTANCE METHODS ----------------------------------
|
/*----------------------TVertex methods ----------------------------*/
|
||||||
|
|
||||||
static char TVertex___doc__[] =
|
PyDoc_STRVAR(TVertex_doc,
|
||||||
"Class hierarchy: :class:`Interface0D` > :class:`ViewVertex` > :class:`TVertex`\n"
|
"Class hierarchy: :class:`Interface0D` > :class:`ViewVertex` > :class:`TVertex`\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Class to define a T vertex, i.e. an intersection between two edges.\n"
|
"Class to define a T vertex, i.e. an intersection between two edges.\n"
|
||||||
@@ -32,138 +32,43 @@ static char TVertex___doc__[] =
|
|||||||
" Copy constructor.\n"
|
" Copy constructor.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg iBrother: A TVertex object.\n"
|
" :arg iBrother: A TVertex object.\n"
|
||||||
" :type iBrother: :class:`TVertex`\n";
|
" :type iBrother: :class:`TVertex`");
|
||||||
|
|
||||||
static int TVertex___init__(BPy_TVertex *self, PyObject *args, PyObject *kwds)
|
static int TVertex_init(BPy_TVertex *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
if( !PyArg_ParseTuple(args, "") )
|
if (!PyArg_ParseTuple(args, ""))
|
||||||
return -1;
|
return -1;
|
||||||
self->tv = new TVertex();
|
self->tv = new TVertex();
|
||||||
self->py_vv.vv = self->tv;
|
self->py_vv.vv = self->tv;
|
||||||
self->py_vv.py_if0D.if0D = self->tv;
|
self->py_vv.py_if0D.if0D = self->tv;
|
||||||
self->py_vv.py_if0D.borrowed = 0;
|
self->py_vv.py_if0D.borrowed = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char TVertex_frontSVertex___doc__[] =
|
PyDoc_STRVAR(TVertex_get_svertex_doc,
|
||||||
".. method:: frontSVertex()\n"
|
".. method:: get_svertex(iFEdge)\n"
|
||||||
"\n"
|
|
||||||
" Returns the SVertex that is closer to the viewpoint.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The SVertex that is closer to the viewpoint.\n"
|
|
||||||
" :rtype: :class:`SVertex`\n";
|
|
||||||
|
|
||||||
static PyObject * TVertex_frontSVertex( BPy_TVertex *self ) {
|
|
||||||
SVertex *v = self->tv->frontSVertex();
|
|
||||||
if( v ){
|
|
||||||
return BPy_SVertex_from_SVertex( *v );
|
|
||||||
}
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char TVertex_backSVertex___doc__[] =
|
|
||||||
".. method:: backSVertex()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the SVertex that is further away from the viewpoint.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The SVertex that is further away from the viewpoint.\n"
|
|
||||||
" :rtype: :class:`SVertex`\n";
|
|
||||||
|
|
||||||
static PyObject * TVertex_backSVertex( BPy_TVertex *self ) {
|
|
||||||
SVertex *v = self->tv->backSVertex();
|
|
||||||
if( v ){
|
|
||||||
return BPy_SVertex_from_SVertex( *v );
|
|
||||||
}
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char TVertex_setFrontSVertex___doc__[] =
|
|
||||||
".. method:: setFrontSVertex(iFrontSVertex)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the SVertex that is closer to the viewpoint.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iFrontSVertex: An SVertex object.\n"
|
|
||||||
" :type iFrontSVertex: :class:`SVertex`\n";
|
|
||||||
|
|
||||||
static PyObject * TVertex_setFrontSVertex( BPy_TVertex *self, PyObject *args) {
|
|
||||||
PyObject *py_sv;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &SVertex_Type, &py_sv) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->tv->setFrontSVertex( ((BPy_SVertex *) py_sv)->sv );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char TVertex_setBackSVertex___doc__[] =
|
|
||||||
".. method:: setBackSVertex(iBackSVertex)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the SVertex that is further away from the viewpoint.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iBackSVertex: An SVertex object.\n"
|
|
||||||
" :type iBackSVertex: :class:`SVertex`\n";
|
|
||||||
|
|
||||||
static PyObject * TVertex_setBackSVertex( BPy_TVertex *self, PyObject *args) {
|
|
||||||
PyObject *py_sv;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O", &SVertex_Type, &py_sv) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->tv->setBackSVertex( ((BPy_SVertex *) py_sv)->sv );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char TVertex_setId___doc__[] =
|
|
||||||
".. method:: setId(iId)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the Id.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iId: An Id object.\n"
|
|
||||||
" :type iId: :class:`Id`\n";
|
|
||||||
|
|
||||||
static PyObject * TVertex_setId( BPy_TVertex *self, PyObject *args) {
|
|
||||||
PyObject *py_id;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &Id_Type, &py_id) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if( ((BPy_Id *) py_id)->id )
|
|
||||||
self->tv->setId(*( ((BPy_Id *) py_id)->id ));
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char TVertex_getSVertex___doc__[] =
|
|
||||||
".. method:: getSVertex(iFEdge)\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
" Returns the SVertex (among the 2) belonging to the given FEdge.\n"
|
" Returns the SVertex (among the 2) belonging to the given FEdge.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg iFEdge: An FEdge object.\n"
|
" :arg iFEdge: An FEdge object.\n"
|
||||||
" :type iFEdge: :class:`FEdge`\n"
|
" :type iFEdge: :class:`FEdge`\n"
|
||||||
" :return: The SVertex belonging to the given FEdge.\n"
|
" :return: The SVertex belonging to the given FEdge.\n"
|
||||||
" :rtype: :class:`SVertex`\n";
|
" :rtype: :class:`SVertex`");
|
||||||
|
|
||||||
static PyObject * TVertex_getSVertex( BPy_TVertex *self, PyObject *args) {
|
static PyObject * TVertex_get_svertex( BPy_TVertex *self, PyObject *args)
|
||||||
|
{
|
||||||
PyObject *py_fe;
|
PyObject *py_fe;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe) ))
|
if (!PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
SVertex *sv = self->tv->getSVertex(((BPy_FEdge *)py_fe)->fe);
|
||||||
SVertex *sv = self->tv->getSVertex( ((BPy_FEdge *) py_fe)->fe );
|
if (sv)
|
||||||
if( sv ){
|
return BPy_SVertex_from_SVertex(*sv);
|
||||||
return BPy_SVertex_from_SVertex( *sv );
|
|
||||||
}
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char TVertex_mate___doc__[] =
|
PyDoc_STRVAR(TVertex_get_mate_doc,
|
||||||
".. method:: mate(iEdgeA)\n"
|
".. method:: get_mate(iEdgeA)\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Returns the mate edge of the ViewEdge given as argument. If the\n"
|
" Returns the mate edge of the ViewEdge given as argument. If the\n"
|
||||||
" ViewEdge is frontEdgeA, frontEdgeB is returned. If the ViewEdge is\n"
|
" ViewEdge is frontEdgeA, frontEdgeB is returned. If the ViewEdge is\n"
|
||||||
@@ -172,34 +77,102 @@ static char TVertex_mate___doc__[] =
|
|||||||
" :arg iEdgeA: A ViewEdge object.\n"
|
" :arg iEdgeA: A ViewEdge object.\n"
|
||||||
" :type iEdgeA: :class:`ViewEdge`\n"
|
" :type iEdgeA: :class:`ViewEdge`\n"
|
||||||
" :return: The mate edge of the given ViewEdge.\n"
|
" :return: The mate edge of the given ViewEdge.\n"
|
||||||
" :rtype: :class:`ViewEdge`\n";
|
" :rtype: :class:`ViewEdge`");
|
||||||
|
|
||||||
static PyObject * TVertex_mate( BPy_TVertex *self, PyObject *args) {
|
static PyObject * TVertex_get_mate( BPy_TVertex *self, PyObject *args)
|
||||||
|
{
|
||||||
PyObject *py_ve;
|
PyObject *py_ve;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &ViewEdge_Type, &py_ve) ))
|
if (!PyArg_ParseTuple(args, "O!", &ViewEdge_Type, &py_ve))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
ViewEdge *ve = self->tv->mate(((BPy_ViewEdge *)py_ve)->ve);
|
||||||
ViewEdge *ve = self->tv->mate( ((BPy_ViewEdge *) py_ve)->ve );
|
if (ve)
|
||||||
if( ve ){
|
return BPy_ViewEdge_from_ViewEdge(*ve);
|
||||||
return BPy_ViewEdge_from_ViewEdge( *ve );
|
|
||||||
}
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------TVertex instance definitions ----------------------------*/
|
static PyMethodDef BPy_TVertex_methods[] = {
|
||||||
static PyMethodDef BPy_TVertex_methods[] = {
|
{"get_svertex", (PyCFunction)TVertex_get_svertex, METH_VARARGS, TVertex_get_svertex_doc},
|
||||||
{"frontSVertex", ( PyCFunction ) TVertex_frontSVertex, METH_NOARGS, TVertex_frontSVertex___doc__},
|
{"get_mate", (PyCFunction)TVertex_get_mate, METH_VARARGS, TVertex_get_mate_doc},
|
||||||
{"backSVertex", ( PyCFunction ) TVertex_backSVertex, METH_NOARGS, TVertex_backSVertex___doc__},
|
|
||||||
{"setFrontSVertex", ( PyCFunction ) TVertex_setFrontSVertex, METH_VARARGS, TVertex_setFrontSVertex___doc__},
|
|
||||||
{"setBackSVertex", ( PyCFunction ) TVertex_setBackSVertex, METH_VARARGS, TVertex_setBackSVertex___doc__},
|
|
||||||
{"setId", ( PyCFunction ) TVertex_setId, METH_VARARGS, TVertex_setId___doc__},
|
|
||||||
{"getSVertex", ( PyCFunction ) TVertex_getSVertex, METH_VARARGS, TVertex_getSVertex___doc__},
|
|
||||||
{"mate", ( PyCFunction ) TVertex_mate, METH_VARARGS, TVertex_mate___doc__},
|
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*----------------------TVertex get/setters ----------------------------*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(TVertex_front_svertex_doc,
|
||||||
|
"The SVertex that is closer to the viewpoint.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`SVertex`");
|
||||||
|
|
||||||
|
static PyObject *TVertex_front_svertex_get(BPy_TVertex *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
SVertex *v = self->tv->frontSVertex();
|
||||||
|
if (v)
|
||||||
|
return BPy_SVertex_from_SVertex(*v);
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int TVertex_front_svertex_set(BPy_TVertex *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!BPy_SVertex_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be an SVertex");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->tv->setFrontSVertex(((BPy_SVertex *)value)->sv);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(TVertex_back_svertex_doc,
|
||||||
|
"The SVertex that is further away from the viewpoint.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`SVertex`");
|
||||||
|
|
||||||
|
static PyObject *TVertex_back_svertex_get(BPy_TVertex *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
SVertex *v = self->tv->backSVertex();
|
||||||
|
if (v)
|
||||||
|
return BPy_SVertex_from_SVertex(*v);
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int TVertex_back_svertex_set(BPy_TVertex *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!BPy_SVertex_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be an SVertex");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->tv->setBackSVertex(((BPy_SVertex *)value)->sv);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(TVertex_id_doc,
|
||||||
|
"The Id of this TVertex.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`Id`");
|
||||||
|
|
||||||
|
static PyObject *TVertex_id_get(BPy_TVertex *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
Id id(self->tv->getId());
|
||||||
|
return BPy_Id_from_Id(id); // return a copy
|
||||||
|
}
|
||||||
|
|
||||||
|
static int TVertex_id_set(BPy_TVertex *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!BPy_Id_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be an Id");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->tv->setId(*(((BPy_Id *)value)->id));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyGetSetDef BPy_TVertex_getseters[] = {
|
||||||
|
{(char *)"front_svertex", (getter)TVertex_front_svertex_get, (setter)TVertex_front_svertex_set, (char *)TVertex_front_svertex_doc, NULL},
|
||||||
|
{(char *)"back_svertex", (getter)TVertex_back_svertex_get, (setter)TVertex_back_svertex_set, (char *)TVertex_back_svertex_doc, NULL},
|
||||||
|
{(char *)"id", (getter)TVertex_id_get, (setter)TVertex_id_set, (char *)TVertex_id_doc, NULL},
|
||||||
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||||
|
};
|
||||||
|
|
||||||
/*-----------------------BPy_TVertex type definition ------------------------------*/
|
/*-----------------------BPy_TVertex type definition ------------------------------*/
|
||||||
PyTypeObject TVertex_Type = {
|
PyTypeObject TVertex_Type = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
@@ -222,7 +195,7 @@ PyTypeObject TVertex_Type = {
|
|||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
TVertex___doc__, /* tp_doc */
|
TVertex_doc, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
@@ -231,13 +204,13 @@ PyTypeObject TVertex_Type = {
|
|||||||
0, /* tp_iternext */
|
0, /* tp_iternext */
|
||||||
BPy_TVertex_methods, /* tp_methods */
|
BPy_TVertex_methods, /* tp_methods */
|
||||||
0, /* tp_members */
|
0, /* tp_members */
|
||||||
0, /* tp_getset */
|
BPy_TVertex_getseters, /* tp_getset */
|
||||||
&ViewVertex_Type, /* tp_base */
|
&ViewVertex_Type, /* tp_base */
|
||||||
0, /* tp_dict */
|
0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
(initproc)TVertex___init__, /* tp_init */
|
(initproc)TVertex_init, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
0, /* tp_new */
|
0, /* tp_new */
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ extern "C" {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//------------------------INSTANCE METHODS ----------------------------------
|
/*----------------------FEdge methods ----------------------------*/
|
||||||
|
|
||||||
static char FEdge___doc__[] =
|
PyDoc_STRVAR(FEdge_doc,
|
||||||
"Class hierarchy: :class:`Interface1D` > :class:`FEdge`\n"
|
"Class hierarchy: :class:`Interface1D` > :class:`FEdge`\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Base Class for feature edges. This FEdge can represent a silhouette,\n"
|
"Base Class for feature edges. This FEdge can represent a silhouette,\n"
|
||||||
@@ -45,23 +45,23 @@ static char FEdge___doc__[] =
|
|||||||
" :arg vA: The first SVertex.\n"
|
" :arg vA: The first SVertex.\n"
|
||||||
" :type vA: :class:`SVertex`\n"
|
" :type vA: :class:`SVertex`\n"
|
||||||
" :arg vB: The second SVertex.\n"
|
" :arg vB: The second SVertex.\n"
|
||||||
" :type vB: :class:`SVertex`\n";
|
" :type vB: :class:`SVertex`");
|
||||||
|
|
||||||
static int FEdge___init__(BPy_FEdge *self, PyObject *args, PyObject *kwds)
|
static int FEdge_init(BPy_FEdge *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyObject *obj1 = 0, *obj2 = 0;
|
PyObject *obj1 = 0, *obj2 = 0;
|
||||||
|
|
||||||
if (! PyArg_ParseTuple(args, "|OO", &obj1, &obj2) )
|
if (!PyArg_ParseTuple(args, "|OO", &obj1, &obj2))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( !obj1 ){
|
if (!obj1) {
|
||||||
self->fe = new FEdge();
|
self->fe = new FEdge();
|
||||||
|
|
||||||
} else if( !obj2 && BPy_FEdge_Check(obj1) ) {
|
} else if(!obj2 && BPy_FEdge_Check(obj1)) {
|
||||||
self->fe = new FEdge(*( ((BPy_FEdge *) obj1)->fe ));
|
self->fe = new FEdge(*(((BPy_FEdge *)obj1)->fe));
|
||||||
|
|
||||||
} else if( obj2 && BPy_SVertex_Check(obj1) && BPy_SVertex_Check(obj2) ) {
|
} else if(obj2 && BPy_SVertex_Check(obj1) && BPy_SVertex_Check(obj2)) {
|
||||||
self->fe = new FEdge( ((BPy_SVertex *) obj1)->sv, ((BPy_SVertex *) obj2)->sv );
|
self->fe = new FEdge(((BPy_SVertex *)obj1)->sv, ((BPy_SVertex *)obj2)->sv);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
|
PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
|
||||||
@@ -74,296 +74,234 @@ static int FEdge___init__(BPy_FEdge *self, PyObject *args, PyObject *kwds)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FEdge_vertexA___doc__[] =
|
static PyMethodDef BPy_FEdge_methods[] = {
|
||||||
".. method:: vertexA()\n"
|
{NULL, NULL, 0, NULL}
|
||||||
"\n"
|
};
|
||||||
" Returns the first SVertex.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The first SVertex.\n"
|
|
||||||
" :rtype: :class:`SVertex`\n";
|
|
||||||
|
|
||||||
static PyObject * FEdge_vertexA( BPy_FEdge *self ) {
|
/*----------------------FEdge sequence protocol ----------------------------*/
|
||||||
SVertex *A = self->fe->vertexA();
|
|
||||||
if( A ){
|
static Py_ssize_t FEdge_sq_length(BPy_FEdge *self)
|
||||||
return BPy_SVertex_from_SVertex( *A );
|
{
|
||||||
}
|
return 2;
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FEdge_vertexB___doc__[] =
|
static PyObject *FEdge_sq_item(BPy_FEdge *self, int keynum)
|
||||||
".. method:: vertexB()\n"
|
{
|
||||||
"\n"
|
if (keynum < 0)
|
||||||
" Returns the second SVertex.\n"
|
keynum += FEdge_sq_length(self);
|
||||||
"\n"
|
if (keynum == 0 || keynum == 1) {
|
||||||
" :return: The second SVertex.\n"
|
SVertex *v = self->fe->operator[](keynum);
|
||||||
" :rtype: :class:`SVertex`\n";
|
if (v)
|
||||||
|
return BPy_SVertex_from_SVertex(*v);
|
||||||
static PyObject * FEdge_vertexB( BPy_FEdge *self ) {
|
|
||||||
SVertex *B = self->fe->vertexB();
|
|
||||||
if( B ){
|
|
||||||
return BPy_SVertex_from_SVertex( *B );
|
|
||||||
}
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static PyObject * FEdge___getitem__( BPy_FEdge *self, PyObject *args ) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "i", &i) ))
|
|
||||||
return NULL;
|
|
||||||
if(!(i == 0 || i == 1)) {
|
|
||||||
PyErr_SetString(PyExc_IndexError, "index must be either 0 or 1");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
SVertex *v = self->fe->operator[](i);
|
|
||||||
if( v )
|
|
||||||
return BPy_SVertex_from_SVertex( *v );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdge_nextEdge___doc__[] =
|
|
||||||
".. method:: nextEdge()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the FEdge following this one in the ViewEdge. If this FEdge\n"
|
|
||||||
" is the last of the ViewEdge, None is returned.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The edge following this one in the ViewEdge.\n"
|
|
||||||
" :rtype: :class:`FEdge`\n";
|
|
||||||
|
|
||||||
static PyObject * FEdge_nextEdge( BPy_FEdge *self ) {
|
|
||||||
FEdge *fe = self->fe->nextEdge();
|
|
||||||
if( fe )
|
|
||||||
return Any_BPy_FEdge_from_FEdge( *fe );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdge_previousEdge___doc__[] =
|
|
||||||
".. method:: previousEdge()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the FEdge preceding this one in the ViewEdge. If this FEdge\n"
|
|
||||||
" is the first one of the ViewEdge, None is returned.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The edge preceding this one in the ViewEdge.\n"
|
|
||||||
" :rtype: :class:`FEdge`\n";
|
|
||||||
|
|
||||||
static PyObject * FEdge_previousEdge( BPy_FEdge *self ) {
|
|
||||||
FEdge *fe = self->fe->previousEdge();
|
|
||||||
if( fe )
|
|
||||||
return Any_BPy_FEdge_from_FEdge( *fe );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdge_viewedge___doc__[] =
|
|
||||||
".. method:: viewedge()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the ViewEdge to which this FEdge belongs to.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The ViewEdge to which this FEdge belongs to.\n"
|
|
||||||
" :rtype: :class:`ViewEdge`\n";
|
|
||||||
|
|
||||||
static PyObject * FEdge_viewedge( BPy_FEdge *self ) {
|
|
||||||
ViewEdge *ve = self->fe->viewedge();
|
|
||||||
if( ve )
|
|
||||||
return BPy_ViewEdge_from_ViewEdge( *ve );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdge_isSmooth___doc__[] =
|
|
||||||
".. method:: isSmooth()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns true if this FEdge is a smooth FEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: True if this FEdge is a smooth FEdge.\n"
|
|
||||||
" :rtype: bool\n";
|
|
||||||
|
|
||||||
static PyObject * FEdge_isSmooth( BPy_FEdge *self ) {
|
|
||||||
return PyBool_from_bool( self->fe->isSmooth() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdge_setVertexA___doc__[] =
|
|
||||||
".. method:: setVertexA(vA)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the first SVertex.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg vA: An SVertex object.\n"
|
|
||||||
" :type vA: :class:`SVertex`\n";
|
|
||||||
|
|
||||||
static PyObject *FEdge_setVertexA( BPy_FEdge *self , PyObject *args) {
|
|
||||||
PyObject *py_sv;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &SVertex_Type, &py_sv) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->fe->setVertexA( ((BPy_SVertex *) py_sv)->sv );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdge_setVertexB___doc__[] =
|
|
||||||
".. method:: setVertexB(vB)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the second SVertex.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg vB: An SVertex object.\n"
|
|
||||||
" :type vB: :class:`SVertex`\n";
|
|
||||||
|
|
||||||
static PyObject *FEdge_setVertexB( BPy_FEdge *self , PyObject *args) {
|
|
||||||
PyObject *py_sv;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O", &py_sv) && BPy_SVertex_Check(py_sv) )) {
|
|
||||||
cout << "ERROR: FEdge_setVertexB" << endl;
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
PyErr_Format(PyExc_IndexError, "FEdge[index]: index %d out of range", keynum);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
self->fe->setVertexB( ((BPy_SVertex *) py_sv)->sv );
|
static PySequenceMethods BPy_FEdge_as_sequence = {
|
||||||
|
(lenfunc)FEdge_sq_length, /* sq_length */
|
||||||
|
NULL, /* sq_concat */
|
||||||
|
NULL, /* sq_repeat */
|
||||||
|
(ssizeargfunc)FEdge_sq_item, /* sq_item */
|
||||||
|
NULL, /* sq_slice */
|
||||||
|
NULL, /* sq_ass_item */
|
||||||
|
NULL, /* *was* sq_ass_slice */
|
||||||
|
NULL, /* sq_contains */
|
||||||
|
NULL, /* sq_inplace_concat */
|
||||||
|
NULL, /* sq_inplace_repeat */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*----------------------FEdge get/setters ----------------------------*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FEdge_first_svertex_doc,
|
||||||
|
"The first SVertex constituting this FEdge.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`SVertex`");
|
||||||
|
|
||||||
|
static PyObject *FEdge_first_svertex_get(BPy_FEdge *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
SVertex *A = self->fe->vertexA();
|
||||||
|
if (A)
|
||||||
|
return BPy_SVertex_from_SVertex(*A);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FEdge_setId___doc__[] =
|
static int FEdge_first_svertex_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure))
|
||||||
".. method:: setId(id)\n"
|
{
|
||||||
|
if (!BPy_SVertex_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be an SVertex");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->fe->setVertexA(((BPy_SVertex *)value)->sv);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FEdge_second_svertex_doc,
|
||||||
|
"The second SVertex constituting this FEdge.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Sets the Id of this FEdge.\n"
|
":type: :class:`SVertex`");
|
||||||
"\n"
|
|
||||||
" :arg id: An Id object.\n"
|
|
||||||
" :type id: :class:`Id`\n";
|
|
||||||
|
|
||||||
static PyObject *FEdge_setId( BPy_FEdge *self , PyObject *args) {
|
|
||||||
PyObject *py_id;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &Id_Type, &py_id) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->fe->setId(*( ((BPy_Id *) py_id)->id ));
|
|
||||||
|
|
||||||
|
static PyObject *FEdge_second_svertex_get(BPy_FEdge *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
SVertex *B = self->fe->vertexB();
|
||||||
|
if (B)
|
||||||
|
return BPy_SVertex_from_SVertex(*B);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FEdge_setNextEdge___doc__[] =
|
static int FEdge_second_svertex_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure))
|
||||||
".. method:: setNextEdge(iEdge)\n"
|
{
|
||||||
|
if (!BPy_SVertex_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be an SVertex");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->fe->setVertexB(((BPy_SVertex *)value)->sv);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FEdge_next_fedge_doc,
|
||||||
|
"The FEdge following this one in the ViewEdge. The value is None if\n"
|
||||||
|
"this FEdge is the last of the ViewEdge.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Sets the pointer to the next FEdge.\n"
|
":type: :class:`FEdge`");
|
||||||
"\n"
|
|
||||||
" :arg iEdge: An FEdge object.\n"
|
|
||||||
" :type iEdge: :class:`FEdge`\n";
|
|
||||||
|
|
||||||
static PyObject *FEdge_setNextEdge( BPy_FEdge *self , PyObject *args) {
|
|
||||||
PyObject *py_fe;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->fe->setNextEdge( ((BPy_FEdge *) py_fe)->fe );
|
|
||||||
|
|
||||||
|
static PyObject *FEdge_next_fedge_get(BPy_FEdge *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
FEdge *fe = self->fe->nextEdge();
|
||||||
|
if (fe)
|
||||||
|
return Any_BPy_FEdge_from_FEdge(*fe);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FEdge_setPreviousEdge___doc__[] =
|
static int FEdge_next_fedge_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure))
|
||||||
".. method:: setPreviousEdge(iEdge)\n"
|
{
|
||||||
|
if (!BPy_FEdge_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be an FEdge");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->fe->setNextEdge(((BPy_FEdge *)value)->fe);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FEdge_previous_fedge_doc,
|
||||||
|
"The FEdge preceding this one in the ViewEdge. The value is None if\n"
|
||||||
|
"this FEdge is the first one of the ViewEdge.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Sets the pointer to the previous FEdge.\n"
|
":type: :class:`FEdge`");
|
||||||
"\n"
|
|
||||||
" :arg iEdge: An FEdge object.\n"
|
|
||||||
" :type iEdge: :class:`FEdge`\n";
|
|
||||||
|
|
||||||
static PyObject *FEdge_setPreviousEdge( BPy_FEdge *self , PyObject *args) {
|
|
||||||
PyObject *py_fe;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->fe->setPreviousEdge( ((BPy_FEdge *) py_fe)->fe );
|
|
||||||
|
|
||||||
|
static PyObject *FEdge_previous_fedge_get(BPy_FEdge *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
FEdge *fe = self->fe->previousEdge();
|
||||||
|
if (fe)
|
||||||
|
return Any_BPy_FEdge_from_FEdge(*fe);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FEdge_setNature___doc__[] =
|
static int FEdge_previous_fedge_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure))
|
||||||
".. method:: setNature(iNature)\n"
|
{
|
||||||
|
if (!BPy_FEdge_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be an FEdge");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->fe->setPreviousEdge(((BPy_FEdge *)value)->fe);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FEdge_viewedge_doc,
|
||||||
|
"The ViewEdge to which this FEdge belongs to.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Sets the nature of this FEdge.\n"
|
":type: :class:`ViewEdge`");
|
||||||
"\n"
|
|
||||||
" :arg iNature: A Nature object.\n"
|
|
||||||
" :type iNature: :class:`Nature`\n";
|
|
||||||
|
|
||||||
static PyObject * FEdge_setNature( BPy_FEdge *self, PyObject *args ) {
|
|
||||||
PyObject *py_n;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &Nature_Type, &py_n) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
PyObject *i = (PyObject *) &( ((BPy_Nature *) py_n)->i );
|
|
||||||
self->fe->setNature( PyLong_AsLong(i) );
|
|
||||||
|
|
||||||
|
static PyObject *FEdge_viewedge_get(BPy_FEdge *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
ViewEdge *ve = self->fe->viewedge();
|
||||||
|
if (ve)
|
||||||
|
return BPy_ViewEdge_from_ViewEdge(*ve);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FEdge_setViewEdge___doc__[] =
|
static int FEdge_viewedge_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure))
|
||||||
".. method:: setViewEdge(iViewEdge)\n"
|
{
|
||||||
"\n"
|
if (!BPy_ViewEdge_Check(value)) {
|
||||||
" Sets the ViewEdge to which this FEdge belongs to.\n"
|
PyErr_SetString(PyExc_TypeError, "value must be an ViewEdge");
|
||||||
"\n"
|
return -1;
|
||||||
" :arg iViewEdge: A ViewEdge object.\n"
|
}
|
||||||
" :type iViewEdge: :class:`ViewEdge`\n";
|
self->fe->setViewEdge(((BPy_ViewEdge *)value)->ve);
|
||||||
|
return 0;
|
||||||
static PyObject * FEdge_setViewEdge( BPy_FEdge *self, PyObject *args ) {
|
|
||||||
PyObject *py_ve;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &ViewEdge_Type, &py_ve) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
ViewEdge *ve = ((BPy_ViewEdge *) py_ve)->ve;
|
|
||||||
self->fe->setViewEdge( ve );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FEdge_setSmooth___doc__[] =
|
PyDoc_STRVAR(FEdge_is_smooth_doc,
|
||||||
".. method:: setSmooth(iFlag)\n"
|
"True if this FEdge is a smooth FEdge.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Sets the flag telling whether this FEdge is smooth or sharp. True\n"
|
":type: bool");
|
||||||
" for Smooth, false for Sharp.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iFlag: True for Smooth, false for Sharp.\n"
|
|
||||||
" :type iFlag: bool\n";
|
|
||||||
|
|
||||||
static PyObject *FEdge_setSmooth( BPy_FEdge *self , PyObject *args) {
|
static PyObject *FEdge_is_smooth_get(BPy_FEdge *self, void *UNUSED(closure))
|
||||||
PyObject *py_b;
|
{
|
||||||
|
return PyBool_from_bool(self->fe->isSmooth());
|
||||||
if(!( PyArg_ParseTuple(args, "O", &py_b) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->fe->setSmooth( bool_from_PyBool(py_b) );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------FEdge instance definitions ----------------------------*/
|
static int FEdge_is_smooth_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!PyBool_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be boolean");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->fe->setSmooth(bool_from_PyBool(value));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static PyMethodDef BPy_FEdge_methods[] = {
|
PyDoc_STRVAR(FEdge_id_doc,
|
||||||
{"vertexA", ( PyCFunction ) FEdge_vertexA, METH_NOARGS, FEdge_vertexA___doc__},
|
"The Id of this FEdge.\n"
|
||||||
{"vertexB", ( PyCFunction ) FEdge_vertexB, METH_NOARGS, FEdge_vertexB___doc__},
|
"\n"
|
||||||
{"__getitem__", ( PyCFunction ) FEdge___getitem__, METH_VARARGS, "(int i) Returns the first SVertex if i=0, the seccond SVertex if i=1."},
|
":type: :class:`Id`");
|
||||||
{"nextEdge", ( PyCFunction ) FEdge_nextEdge, METH_NOARGS, FEdge_nextEdge___doc__},
|
|
||||||
{"previousEdge", ( PyCFunction ) FEdge_previousEdge, METH_NOARGS, FEdge_previousEdge___doc__},
|
static PyObject *FEdge_id_get(BPy_FEdge *self, void *UNUSED(closure))
|
||||||
{"viewedge", ( PyCFunction ) FEdge_viewedge, METH_NOARGS, FEdge_viewedge___doc__},
|
{
|
||||||
{"isSmooth", ( PyCFunction ) FEdge_isSmooth, METH_NOARGS, FEdge_isSmooth___doc__},
|
Id id(self->fe->getId());
|
||||||
{"setVertexA", ( PyCFunction ) FEdge_setVertexA, METH_VARARGS, FEdge_setVertexA___doc__},
|
return BPy_Id_from_Id(id); // return a copy
|
||||||
{"setVertexB", ( PyCFunction ) FEdge_setVertexB, METH_VARARGS, FEdge_setVertexB___doc__},
|
}
|
||||||
{"setId", ( PyCFunction ) FEdge_setId, METH_VARARGS, FEdge_setId___doc__},
|
|
||||||
{"setNextEdge", ( PyCFunction ) FEdge_setNextEdge, METH_VARARGS, FEdge_setNextEdge___doc__},
|
static int FEdge_id_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure))
|
||||||
{"setPreviousEdge", ( PyCFunction ) FEdge_setPreviousEdge, METH_VARARGS, FEdge_setPreviousEdge___doc__},
|
{
|
||||||
{"setSmooth", ( PyCFunction ) FEdge_setSmooth, METH_VARARGS, FEdge_setSmooth___doc__},
|
if (!BPy_Id_Check(value)) {
|
||||||
{"setViewEdge", ( PyCFunction ) FEdge_setViewEdge, METH_VARARGS, FEdge_setViewEdge___doc__},
|
PyErr_SetString(PyExc_TypeError, "value must be an Id");
|
||||||
{"setNature", ( PyCFunction ) FEdge_setNature, METH_VARARGS, FEdge_setNature___doc__},
|
return -1;
|
||||||
{NULL, NULL, 0, NULL}
|
}
|
||||||
|
self->fe->setId(*(((BPy_Id *)value)->id));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FEdge_nature_doc,
|
||||||
|
"The nature of this FEdge.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`Nature`");
|
||||||
|
|
||||||
|
static PyObject *FEdge_nature_get(BPy_FEdge *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return BPy_Nature_from_Nature(self->fe->getNature());
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FEdge_nature_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!BPy_Nature_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be a Nature");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->fe->setNature(PyLong_AsLong((PyObject *)&((BPy_Nature *)value)->i));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyGetSetDef BPy_FEdge_getseters[] = {
|
||||||
|
{(char *)"first_svertex", (getter)FEdge_first_svertex_get, (setter)FEdge_first_svertex_set, (char *)FEdge_first_svertex_doc, NULL},
|
||||||
|
{(char *)"second_svertex", (getter)FEdge_second_svertex_get, (setter)FEdge_second_svertex_set, (char *)FEdge_second_svertex_doc, NULL},
|
||||||
|
{(char *)"next_fedge", (getter)FEdge_next_fedge_get, (setter)FEdge_next_fedge_set, (char *)FEdge_next_fedge_doc, NULL},
|
||||||
|
{(char *)"previous_fedge", (getter)FEdge_previous_fedge_get, (setter)FEdge_previous_fedge_set, (char *)FEdge_previous_fedge_doc, NULL},
|
||||||
|
{(char *)"viewedge", (getter)FEdge_viewedge_get, (setter)FEdge_viewedge_set, (char *)FEdge_viewedge_doc, NULL},
|
||||||
|
{(char *)"is_smooth", (getter)FEdge_is_smooth_get, (setter)FEdge_is_smooth_set, (char *)FEdge_is_smooth_doc, NULL},
|
||||||
|
{(char *)"id", (getter)FEdge_id_get, (setter)FEdge_id_set, (char *)FEdge_id_doc, NULL},
|
||||||
|
{(char *)"nature", (getter)FEdge_nature_get, (setter)FEdge_nature_set, (char *)FEdge_nature_doc, NULL},
|
||||||
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-----------------------BPy_FEdge type definition ------------------------------*/
|
/*-----------------------BPy_FEdge type definition ------------------------------*/
|
||||||
@@ -380,7 +318,7 @@ PyTypeObject FEdge_Type = {
|
|||||||
0, /* tp_reserved */
|
0, /* tp_reserved */
|
||||||
0, /* tp_repr */
|
0, /* tp_repr */
|
||||||
0, /* tp_as_number */
|
0, /* tp_as_number */
|
||||||
0, /* tp_as_sequence */
|
&BPy_FEdge_as_sequence, /* tp_as_sequence */
|
||||||
0, /* tp_as_mapping */
|
0, /* tp_as_mapping */
|
||||||
0, /* tp_hash */
|
0, /* tp_hash */
|
||||||
0, /* tp_call */
|
0, /* tp_call */
|
||||||
@@ -389,7 +327,7 @@ PyTypeObject FEdge_Type = {
|
|||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
FEdge___doc__, /* tp_doc */
|
FEdge_doc, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
@@ -398,13 +336,13 @@ PyTypeObject FEdge_Type = {
|
|||||||
0, /* tp_iternext */
|
0, /* tp_iternext */
|
||||||
BPy_FEdge_methods, /* tp_methods */
|
BPy_FEdge_methods, /* tp_methods */
|
||||||
0, /* tp_members */
|
0, /* tp_members */
|
||||||
0, /* tp_getset */
|
BPy_FEdge_getseters, /* tp_getset */
|
||||||
&Interface1D_Type, /* tp_base */
|
&Interface1D_Type, /* tp_base */
|
||||||
0, /* tp_dict */
|
0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
(initproc)FEdge___init__, /* tp_init */
|
(initproc)FEdge_init, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
0, /* tp_new */
|
0, /* tp_new */
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ extern "C" {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//------------------------INSTANCE METHODS ----------------------------------
|
/*----------------------CurvePoint methods ----------------------------*/
|
||||||
|
|
||||||
static char FrsCurve___doc__[] =
|
PyDoc_STRVAR(FrsCurve_doc,
|
||||||
"Class hierarchy: :class:`Interface1D` > :class:`Curve`\n"
|
"Class hierarchy: :class:`Interface1D` > :class:`Curve`\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Base class for curves made of CurvePoints. :class:`SVertex` is the\n"
|
"Base class for curves made of CurvePoints. :class:`SVertex` is the\n"
|
||||||
@@ -36,25 +36,25 @@ static char FrsCurve___doc__[] =
|
|||||||
" Builds a Curve from its Id.\n"
|
" Builds a Curve from its Id.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg iId: An Id object.\n"
|
" :arg iId: An Id object.\n"
|
||||||
" :type iId: :class:`Id`\n";
|
" :type iId: :class:`Id`");
|
||||||
|
|
||||||
static int FrsCurve___init__(BPy_FrsCurve *self, PyObject *args, PyObject *kwds)
|
static int FrsCurve_init(BPy_FrsCurve *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
|
|
||||||
PyObject *obj = 0;
|
PyObject *obj = 0;
|
||||||
|
|
||||||
if (! PyArg_ParseTuple(args, "|O", &obj) )
|
if (!PyArg_ParseTuple(args, "|O", &obj))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( !obj ){
|
if (!obj) {
|
||||||
self->c = new Curve();
|
self->c = new Curve();
|
||||||
|
|
||||||
} else if( BPy_FrsCurve_Check(obj) ) {
|
} else if (BPy_FrsCurve_Check(obj)) {
|
||||||
self->c = new Curve(*( ((BPy_FrsCurve *) obj)->c ));
|
self->c = new Curve(*( ((BPy_FrsCurve *) obj)->c ));
|
||||||
|
|
||||||
} else if( BPy_Id_Check(obj) ) {
|
} else if (BPy_Id_Check(obj)) {
|
||||||
self->c = new Curve(*( ((BPy_Id *) obj)->id ));
|
self->c = new Curve(*( ((BPy_Id *) obj)->id ));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError, "invalid argument");
|
PyErr_SetString(PyExc_TypeError, "invalid argument");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -66,24 +66,25 @@ static int FrsCurve___init__(BPy_FrsCurve *self, PyObject *args, PyObject *kwds)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FrsCurve_push_vertex_back___doc__[] =
|
PyDoc_STRVAR(FrsCurve_push_vertex_back_doc,
|
||||||
".. method:: push_vertex_back(iVertex)\n"
|
".. method:: push_vertex_back(iVertex)\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Adds a single vertex at the end of the Curve.\n"
|
" Adds a single vertex at the end of the Curve.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg iVertex: A vertex object.\n"
|
" :arg iVertex: A vertex object.\n"
|
||||||
" :type iVertex: :class:`SVertex` or :class:`CurvePoint`\n";
|
" :type iVertex: :class:`SVertex` or :class:`CurvePoint`");
|
||||||
|
|
||||||
static PyObject * FrsCurve_push_vertex_back( BPy_FrsCurve *self, PyObject *args ) {
|
static PyObject * FrsCurve_push_vertex_back( BPy_FrsCurve *self, PyObject *args )
|
||||||
|
{
|
||||||
PyObject *obj;
|
PyObject *obj;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O", &obj) ))
|
if (!PyArg_ParseTuple(args, "O", &obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if( BPy_CurvePoint_Check(obj) ) {
|
if (BPy_CurvePoint_Check(obj)) {
|
||||||
self->c->push_vertex_back( ((BPy_CurvePoint *) obj)->cp );
|
self->c->push_vertex_back(((BPy_CurvePoint *)obj)->cp);
|
||||||
} else if( BPy_SVertex_Check(obj) ) {
|
} else if (BPy_SVertex_Check(obj)) {
|
||||||
self->c->push_vertex_back( ((BPy_SVertex *) obj)->sv );
|
self->c->push_vertex_back(((BPy_SVertex *)obj)->sv);
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError, "invalid argument");
|
PyErr_SetString(PyExc_TypeError, "invalid argument");
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -92,24 +93,25 @@ static PyObject * FrsCurve_push_vertex_back( BPy_FrsCurve *self, PyObject *args
|
|||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FrsCurve_push_vertex_front___doc__[] =
|
PyDoc_STRVAR(FrsCurve_push_vertex_front_doc,
|
||||||
".. method:: push_vertex_front(iVertex)\n"
|
".. method:: push_vertex_front(iVertex)\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Adds a single vertex at the front of the Curve.\n"
|
" Adds a single vertex at the front of the Curve.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg iVertex: A vertex object.\n"
|
" :arg iVertex: A vertex object.\n"
|
||||||
" :type iVertex: :class:`SVertex` or :class:`CurvePoint`\n";
|
" :type iVertex: :class:`SVertex` or :class:`CurvePoint`");
|
||||||
|
|
||||||
static PyObject * FrsCurve_push_vertex_front( BPy_FrsCurve *self, PyObject *args ) {
|
static PyObject * FrsCurve_push_vertex_front( BPy_FrsCurve *self, PyObject *args )
|
||||||
|
{
|
||||||
PyObject *obj;
|
PyObject *obj;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O", &obj) ))
|
if (!PyArg_ParseTuple(args, "O", &obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if( BPy_CurvePoint_Check(obj) ) {
|
if (BPy_CurvePoint_Check(obj)) {
|
||||||
self->c->push_vertex_front( ((BPy_CurvePoint *) obj)->cp );
|
self->c->push_vertex_front(((BPy_CurvePoint *)obj)->cp);
|
||||||
} else if( BPy_SVertex_Check(obj) ) {
|
} else if( BPy_SVertex_Check(obj)) {
|
||||||
self->c->push_vertex_front( ((BPy_SVertex *) obj)->sv );
|
self->c->push_vertex_front(((BPy_SVertex *)obj)->sv);
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError, "invalid argument");
|
PyErr_SetString(PyExc_TypeError, "invalid argument");
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -118,40 +120,40 @@ static PyObject * FrsCurve_push_vertex_front( BPy_FrsCurve *self, PyObject *args
|
|||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FrsCurve_empty___doc__[] =
|
|
||||||
".. method:: empty()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns true if the Curve doesn't have any Vertex yet.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: True if the Curve has no vertices.\n"
|
|
||||||
" :rtype: bool\n";
|
|
||||||
|
|
||||||
static PyObject * FrsCurve_empty( BPy_FrsCurve *self ) {
|
|
||||||
return PyBool_from_bool( self->c->empty() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FrsCurve_nSegments___doc__[] =
|
|
||||||
".. method:: nSegments()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the number of segments in the polyline constituing the\n"
|
|
||||||
" Curve.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The number of segments.\n"
|
|
||||||
" :rtype: int\n";
|
|
||||||
|
|
||||||
static PyObject * FrsCurve_nSegments( BPy_FrsCurve *self ) {
|
|
||||||
return PyLong_FromLong( self->c->nSegments() );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*----------------------FrsCurve instance definitions ----------------------------*/
|
|
||||||
static PyMethodDef BPy_FrsCurve_methods[] = {
|
static PyMethodDef BPy_FrsCurve_methods[] = {
|
||||||
{"push_vertex_back", ( PyCFunction ) FrsCurve_push_vertex_back, METH_VARARGS, FrsCurve_push_vertex_back___doc__},
|
{"push_vertex_back", (PyCFunction)FrsCurve_push_vertex_back, METH_VARARGS, FrsCurve_push_vertex_back_doc},
|
||||||
{"push_vertex_front", ( PyCFunction ) FrsCurve_push_vertex_front, METH_VARARGS, FrsCurve_push_vertex_front___doc__},
|
{"push_vertex_front", (PyCFunction)FrsCurve_push_vertex_front, METH_VARARGS, FrsCurve_push_vertex_front_doc},
|
||||||
{"empty", ( PyCFunction ) FrsCurve_empty, METH_NOARGS, FrsCurve_empty___doc__},
|
|
||||||
{"nSegments", ( PyCFunction ) FrsCurve_nSegments, METH_NOARGS, FrsCurve_nSegments___doc__},
|
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*----------------------CurvePoint get/setters ----------------------------*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FrsCurve_is_empty_doc,
|
||||||
|
"True if the Curve doesn't have any Vertex yet.\n"
|
||||||
|
"\n"
|
||||||
|
":type: bool");
|
||||||
|
|
||||||
|
static PyObject *FrsCurve_is_empty_get(BPy_FrsCurve *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyBool_from_bool(self->c->empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FrsCurve_segments_size_doc,
|
||||||
|
"The number of segments in the polyline constituing the Curve.\n"
|
||||||
|
"\n"
|
||||||
|
":type: int");
|
||||||
|
|
||||||
|
static PyObject *FrsCurve_segments_size_get(BPy_FrsCurve *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyLong_FromLong(self->c->nSegments());
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyGetSetDef BPy_FrsCurve_getseters[] = {
|
||||||
|
{(char *)"is_empty", (getter)FrsCurve_is_empty_get, (setter)NULL, (char *)FrsCurve_is_empty_doc, NULL},
|
||||||
|
{(char *)"segments_size", (getter)FrsCurve_segments_size_get, (setter)NULL, (char *)FrsCurve_segments_size_doc, NULL},
|
||||||
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||||
|
};
|
||||||
|
|
||||||
/*-----------------------BPy_FrsCurve type definition ------------------------------*/
|
/*-----------------------BPy_FrsCurve type definition ------------------------------*/
|
||||||
|
|
||||||
PyTypeObject FrsCurve_Type = {
|
PyTypeObject FrsCurve_Type = {
|
||||||
@@ -175,7 +177,7 @@ PyTypeObject FrsCurve_Type = {
|
|||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
FrsCurve___doc__, /* tp_doc */
|
FrsCurve_doc, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
@@ -184,13 +186,13 @@ PyTypeObject FrsCurve_Type = {
|
|||||||
0, /* tp_iternext */
|
0, /* tp_iternext */
|
||||||
BPy_FrsCurve_methods, /* tp_methods */
|
BPy_FrsCurve_methods, /* tp_methods */
|
||||||
0, /* tp_members */
|
0, /* tp_members */
|
||||||
0, /* tp_getset */
|
BPy_FrsCurve_getseters, /* tp_getset */
|
||||||
&Interface1D_Type, /* tp_base */
|
&Interface1D_Type, /* tp_base */
|
||||||
0, /* tp_dict */
|
0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
(initproc)FrsCurve___init__, /* tp_init */
|
(initproc)FrsCurve_init, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
0, /* tp_new */
|
0, /* tp_new */
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ extern "C" {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//------------------------INSTANCE METHODS ----------------------------------
|
/*----------------------Stroke methods ----------------------------*/
|
||||||
|
|
||||||
// Stroke ()
|
// Stroke ()
|
||||||
// template<class InputVertexIterator> Stroke (InputVertexIterator iBegin, InputVertexIterator iEnd)
|
// template<class InputVertexIterator> Stroke (InputVertexIterator iBegin, InputVertexIterator iEnd)
|
||||||
@@ -21,7 +21,7 @@ extern "C" {
|
|||||||
// pb: - need to be able to switch representation: InputVertexIterator <=> position
|
// pb: - need to be able to switch representation: InputVertexIterator <=> position
|
||||||
// - is it even used ? not even in SWIG version
|
// - is it even used ? not even in SWIG version
|
||||||
|
|
||||||
static char Stroke___doc__[] =
|
PyDoc_STRVAR(Stroke_doc,
|
||||||
"Class hierarchy: :class:`Interface1D` > :class:`Stroke`\n"
|
"Class hierarchy: :class:`Interface1D` > :class:`Stroke`\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Class to define a stroke. A stroke is made of a set of 2D vertices\n"
|
"Class to define a stroke. A stroke is made of a set of 2D vertices\n"
|
||||||
@@ -49,25 +49,26 @@ static char Stroke___doc__[] =
|
|||||||
" :arg iBegin: The iterator pointing to the first vertex.\n"
|
" :arg iBegin: The iterator pointing to the first vertex.\n"
|
||||||
" :type iBegin: InputVertexIterator\n"
|
" :type iBegin: InputVertexIterator\n"
|
||||||
" :arg iEnd: The iterator pointing to the end of the vertex list.\n"
|
" :arg iEnd: The iterator pointing to the end of the vertex list.\n"
|
||||||
" :type iEnd: InputVertexIterator\n";
|
" :type iEnd: InputVertexIterator");
|
||||||
|
|
||||||
static int Stroke___init__(BPy_Stroke *self, PyObject *args, PyObject *kwds)
|
static int Stroke_init(BPy_Stroke *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyObject *obj1 = NULL, *obj2 = NULL;
|
PyObject *obj1 = NULL, *obj2 = NULL;
|
||||||
|
|
||||||
if (! PyArg_ParseTuple(args, "|OO", &obj1, &obj2) )
|
if (!PyArg_ParseTuple(args, "|OO", &obj1, &obj2))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( !obj1 ){
|
if (!obj1) {
|
||||||
self->s = new Stroke();
|
self->s = new Stroke();
|
||||||
|
|
||||||
} else if ( !obj2 && BPy_Stroke_Check(obj1) ) {
|
} else if (!obj2 && BPy_Stroke_Check(obj1)) {
|
||||||
self->s = new Stroke(*( ((BPy_Stroke *)obj1)->s ));
|
self->s = new Stroke(*(((BPy_Stroke *)obj1)->s));
|
||||||
|
|
||||||
} else if ( obj2 ) {
|
} else if (obj2) {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
"Stroke(InputVertexIterator iBegin, InputVertexIterator iEnd) not implemented");
|
"Stroke(InputVertexIterator iBegin, InputVertexIterator iEnd) not implemented");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
|
PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -79,41 +80,30 @@ static int Stroke___init__(BPy_Stroke *self, PyObject *args, PyObject *kwds)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject * Stroke___iter__( PyObject *self ) {
|
static PyObject * Stroke_iter(PyObject *self)
|
||||||
|
{
|
||||||
StrokeInternal::StrokeVertexIterator sv_it( ((BPy_Stroke *)self)->s->strokeVerticesBegin() );
|
StrokeInternal::StrokeVertexIterator sv_it( ((BPy_Stroke *)self)->s->strokeVerticesBegin() );
|
||||||
return BPy_StrokeVertexIterator_from_StrokeVertexIterator( sv_it, 0 );
|
return BPy_StrokeVertexIterator_from_StrokeVertexIterator( sv_it, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static Py_ssize_t Stroke_length( BPy_Stroke *self ) {
|
static Py_ssize_t Stroke_sq_length(BPy_Stroke *self)
|
||||||
|
{
|
||||||
return self->s->strokeVerticesSize();
|
return self->s->strokeVerticesSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject * Stroke_item( BPy_Stroke *self, Py_ssize_t i ) {
|
static PyObject *Stroke_sq_item(BPy_Stroke *self, int keynum)
|
||||||
if (i < 0 || i >= (Py_ssize_t)self->s->strokeVerticesSize()) {
|
{
|
||||||
PyErr_SetString(PyExc_IndexError, "subscript index out of range");
|
if (keynum < 0)
|
||||||
|
keynum += Stroke_sq_length(self);
|
||||||
|
if (keynum < 0 || keynum >= Stroke_sq_length(self)) {
|
||||||
|
PyErr_Format(PyExc_IndexError, "Stroke[index]: index %d out of range", keynum);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return BPy_StrokeVertex_from_StrokeVertex( self->s->strokeVerticeAt(i) );
|
return BPy_StrokeVertex_from_StrokeVertex(self->s->strokeVerticeAt(keynum));
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject * Stroke___getitem__( BPy_Stroke *self, PyObject *item ) {
|
PyDoc_STRVAR(Stroke_compute_sampling_doc,
|
||||||
long i;
|
".. method:: compute_sampling(iNVertices)\n"
|
||||||
|
|
||||||
if (!PyLong_Check(item)) {
|
|
||||||
PyErr_SetString(PyExc_TypeError, "subscript indices must be integers");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
i = PyLong_AsLong(item);
|
|
||||||
if (i == -1 && PyErr_Occurred())
|
|
||||||
return NULL;
|
|
||||||
if (i < 0) {
|
|
||||||
i += self->s->strokeVerticesSize();
|
|
||||||
}
|
|
||||||
return Stroke_item(self, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Stroke_ComputeSampling___doc__[] =
|
|
||||||
".. method:: ComputeSampling(iNVertices)\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
" Compute the sampling needed to get iNVertices vertices. If the\n"
|
" Compute the sampling needed to get iNVertices vertices. If the\n"
|
||||||
" specified number of vertices is less than the actual number of\n"
|
" specified number of vertices is less than the actual number of\n"
|
||||||
@@ -125,19 +115,19 @@ static char Stroke_ComputeSampling___doc__[] =
|
|||||||
" :type iNVertices: int\n"
|
" :type iNVertices: int\n"
|
||||||
" :return: The sampling that must be used in the Resample(float)\n"
|
" :return: The sampling that must be used in the Resample(float)\n"
|
||||||
" method.\n"
|
" method.\n"
|
||||||
" :rtype: float\n";
|
" :rtype: float");
|
||||||
|
|
||||||
static PyObject * Stroke_ComputeSampling( BPy_Stroke *self, PyObject *args ) {
|
static PyObject * Stroke_compute_sampling(BPy_Stroke *self, PyObject *args)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "i", &i) ))
|
if (!PyArg_ParseTuple(args, "i", &i))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
return PyFloat_FromDouble(self->s->ComputeSampling(i));
|
||||||
return PyFloat_FromDouble( self->s->ComputeSampling( i ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char Stroke_Resample___doc__[] =
|
PyDoc_STRVAR(Stroke_resample_doc,
|
||||||
".. method:: Resample(iNPoints)\n"
|
".. method:: resample(iNPoints)\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Resamples the stroke so that it eventually has iNPoints. That means\n"
|
" Resamples the stroke so that it eventually has iNPoints. That means\n"
|
||||||
" it is going to add iNPoints-vertices_size, if vertices_size is the\n"
|
" it is going to add iNPoints-vertices_size, if vertices_size is the\n"
|
||||||
@@ -147,34 +137,33 @@ static char Stroke_Resample___doc__[] =
|
|||||||
" :arg iNPoints: The number of vertices we eventually want in our stroke.\n"
|
" :arg iNPoints: The number of vertices we eventually want in our stroke.\n"
|
||||||
" :type iNPoints: int\n"
|
" :type iNPoints: int\n"
|
||||||
"\n"
|
"\n"
|
||||||
".. method:: Resample(iSampling)\n"
|
".. method:: resample(iSampling)\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Resamples the stroke with a given sampling. If the sampling is\n"
|
" Resamples the stroke with a given sampling. If the sampling is\n"
|
||||||
" smaller than the actual sampling value, no resampling is done.\n"
|
" smaller than the actual sampling value, no resampling is done.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg iSampling: The new sampling value.\n"
|
" :arg iSampling: The new sampling value.\n"
|
||||||
" :type iSampling: float\n";
|
" :type iSampling: float");
|
||||||
|
|
||||||
static PyObject * Stroke_Resample( BPy_Stroke *self, PyObject *args ) {
|
static PyObject * Stroke_resample(BPy_Stroke *self, PyObject *args)
|
||||||
|
{
|
||||||
PyObject *obj;
|
PyObject *obj;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O", &obj) ))
|
if (!PyArg_ParseTuple(args, "O", &obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
if (PyLong_Check(obj)) {
|
||||||
if( PyLong_Check(obj) )
|
self->s->Resample((int)PyLong_AsLong(obj));
|
||||||
self->s->Resample( (int) PyLong_AsLong(obj) );
|
} else if (PyFloat_Check(obj)) {
|
||||||
else if( PyFloat_Check(obj) )
|
self->s->Resample((float)PyFloat_AsDouble(obj));
|
||||||
self->s->Resample( (float) PyFloat_AsDouble(obj) );
|
} else {
|
||||||
else {
|
|
||||||
PyErr_SetString(PyExc_TypeError, "invalid argument");
|
PyErr_SetString(PyExc_TypeError, "invalid argument");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char Stroke_InsertVertex___doc__[] =
|
PyDoc_STRVAR(Stroke_insert_vertex_doc,
|
||||||
".. method:: InsertVertex(iVertex, next)\n"
|
".. method:: insert_vertex(iVertex, next)\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Inserts the stroke vertex iVertex in the stroke before next. The\n"
|
" Inserts the stroke vertex iVertex in the stroke before next. The\n"
|
||||||
" length, curvilinear abscissa are updated consequently.\n"
|
" length, curvilinear abscissa are updated consequently.\n"
|
||||||
@@ -183,206 +172,57 @@ static char Stroke_InsertVertex___doc__[] =
|
|||||||
" :type iVertex: :class:`StrokeVertex`\n"
|
" :type iVertex: :class:`StrokeVertex`\n"
|
||||||
" :arg next: A StrokeVertexIterator pointing to the StrokeVertex\n"
|
" :arg next: A StrokeVertexIterator pointing to the StrokeVertex\n"
|
||||||
" before which iVertex must be inserted.\n"
|
" before which iVertex must be inserted.\n"
|
||||||
" :type next: :class:`StrokeVertexIterator`\n";
|
" :type next: :class:`StrokeVertexIterator`");
|
||||||
|
|
||||||
static PyObject * Stroke_InsertVertex( BPy_Stroke *self, PyObject *args ) {
|
static PyObject * Stroke_insert_vertex(BPy_Stroke *self, PyObject *args)
|
||||||
|
{
|
||||||
PyObject *py_sv = 0, *py_sv_it = 0;
|
PyObject *py_sv = 0, *py_sv_it = 0;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!O!", &StrokeVertex_Type, &py_sv, &StrokeVertexIterator_Type, &py_sv_it) ))
|
if (!PyArg_ParseTuple(args, "O!O!", &StrokeVertex_Type, &py_sv, &StrokeVertexIterator_Type, &py_sv_it))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
StrokeVertex *sv = ((BPy_StrokeVertex *)py_sv)->sv;
|
||||||
StrokeVertex *sv = ((BPy_StrokeVertex *) py_sv)->sv;
|
StrokeInternal::StrokeVertexIterator sv_it(*(((BPy_StrokeVertexIterator *)py_sv_it)->sv_it));
|
||||||
StrokeInternal::StrokeVertexIterator sv_it(*( ((BPy_StrokeVertexIterator *) py_sv_it)->sv_it ));
|
self->s->InsertVertex(sv, sv_it);
|
||||||
self->s->InsertVertex( sv, sv_it );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char Stroke_RemoveVertex___doc__[] =
|
PyDoc_STRVAR(Stroke_remove_vertex_doc,
|
||||||
".. method:: RemoveVertex(iVertex)\n"
|
".. method:: remove_vertex(iVertex)\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Removes the stroke vertex iVertex from the stroke. The length and\n"
|
" Removes the stroke vertex iVertex from the stroke. The length and\n"
|
||||||
" curvilinear abscissa are updated consequently.\n"
|
" curvilinear abscissa are updated consequently.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg iVertex: \n"
|
" :arg iVertex: \n"
|
||||||
" :type iVertex: :class:`StrokeVertex`\n";
|
" :type iVertex: :class:`StrokeVertex`");
|
||||||
|
|
||||||
static PyObject * Stroke_RemoveVertex( BPy_Stroke *self, PyObject *args ) {
|
static PyObject * Stroke_remove_vertex( BPy_Stroke *self, PyObject *args )
|
||||||
|
{
|
||||||
PyObject *py_sv;
|
PyObject *py_sv;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &StrokeVertex_Type, &py_sv) ))
|
if (!PyArg_ParseTuple(args, "O!", &StrokeVertex_Type, &py_sv))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
if (((BPy_StrokeVertex *)py_sv)->sv) {
|
||||||
if( ((BPy_StrokeVertex *) py_sv)->sv )
|
self->s->RemoveVertex(((BPy_StrokeVertex *)py_sv)->sv);
|
||||||
self->s->RemoveVertex( ((BPy_StrokeVertex *) py_sv)->sv );
|
} else {
|
||||||
else {
|
|
||||||
PyErr_SetString(PyExc_TypeError, "invalid argument");
|
PyErr_SetString(PyExc_TypeError, "invalid argument");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char Stroke_UpdateLength___doc__[] =
|
PyDoc_STRVAR(Stroke_update_length_doc,
|
||||||
".. method:: UpdateLength()\n"
|
".. method:: update_length()\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Updates the 2D length of the Stroke.\n";
|
" Updates the 2D length of the Stroke.");
|
||||||
|
|
||||||
static PyObject * Stroke_UpdateLength( BPy_Stroke *self ) {
|
static PyObject * Stroke_update_length(BPy_Stroke *self)
|
||||||
|
{
|
||||||
self->s->UpdateLength();
|
self->s->UpdateLength();
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char Stroke_getLength2D___doc__[] =
|
PyDoc_STRVAR(Stroke_stroke_vertices_begin_doc,
|
||||||
".. method:: getLength2D()\n"
|
".. method:: stroke_vertices_begin(t=0.0)\n"
|
||||||
"\n"
|
|
||||||
" Returns the 2D length of the Stroke.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: the 2D length of the Stroke.\n"
|
|
||||||
" :rtype: float\n";
|
|
||||||
|
|
||||||
static PyObject * Stroke_getLength2D( BPy_Stroke *self ) {
|
|
||||||
return PyFloat_FromDouble( self->s->getLength2D() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Stroke_getMediumType___doc__[] =
|
|
||||||
".. method:: getMediumType()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the MediumType used for this Stroke.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: the MediumType used for this Stroke.\n"
|
|
||||||
" :rtype: :class:`MediumType`\n";
|
|
||||||
|
|
||||||
static PyObject * Stroke_getMediumType( BPy_Stroke *self ) {
|
|
||||||
return BPy_MediumType_from_MediumType( self->s->getMediumType() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Stroke_getTextureId___doc__[] =
|
|
||||||
".. method:: getTextureId()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the ID of the texture used to simulate th marks system for\n"
|
|
||||||
" this Stroke\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The texture ID.\n"
|
|
||||||
" :rtype: int\n";
|
|
||||||
|
|
||||||
static PyObject * Stroke_getTextureId( BPy_Stroke *self ) {
|
|
||||||
return PyLong_FromLong( self->s->getTextureId() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Stroke_hasTips___doc__[] =
|
|
||||||
".. method:: hasTips()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns true if this Stroke uses a texture with tips, false\n"
|
|
||||||
" otherwise.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: True if this Stroke uses a texture with tips.\n"
|
|
||||||
" :rtype: bool\n";
|
|
||||||
|
|
||||||
static PyObject * Stroke_hasTips( BPy_Stroke *self ) {
|
|
||||||
return PyBool_from_bool( self->s->hasTips() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Stroke_setId___doc__[] =
|
|
||||||
".. method:: setId(id)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the Id of the Stroke.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg id: the Id of the Stroke.\n"
|
|
||||||
" :type id: :class:`Id`\n";
|
|
||||||
|
|
||||||
static PyObject *Stroke_setId( BPy_Stroke *self , PyObject *args) {
|
|
||||||
PyObject *py_id;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &Id_Type, &py_id) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->s->setId(*( ((BPy_Id *) py_id)->id ));
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Stroke_setLength___doc__[] =
|
|
||||||
".. method:: setLength(iLength)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the 2D length of the Stroke.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iLength: The 2D length of the Stroke.\n"
|
|
||||||
" :type iLength: float\n";
|
|
||||||
|
|
||||||
static PyObject *Stroke_setLength( BPy_Stroke *self , PyObject *args) {
|
|
||||||
float f;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "f", &f) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->s->setLength( f );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Stroke_setMediumType___doc__[] =
|
|
||||||
".. method:: setMediumType(iType)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the medium type that must be used for this Stroke.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iType: A MediumType object.\n"
|
|
||||||
" :type iType: :class:`MediumType`\n";
|
|
||||||
|
|
||||||
static PyObject *Stroke_setMediumType( BPy_Stroke *self , PyObject *args) {
|
|
||||||
PyObject *py_mt;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &MediumType_Type, &py_mt) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->s->setMediumType( MediumType_from_BPy_MediumType(py_mt) );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Stroke_setTextureId___doc__[] =
|
|
||||||
".. method:: setTextureId(iId)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the texture ID to be used to simulate the marks system for this\n"
|
|
||||||
" Stroke.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iId: A texture ID.\n"
|
|
||||||
" :type iId: int\n";
|
|
||||||
|
|
||||||
static PyObject *Stroke_setTextureId( BPy_Stroke *self , PyObject *args) {
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "I", &i) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->s->setTextureId( i );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Stroke_setTips___doc__[] =
|
|
||||||
".. method:: setTips(iTips)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the flag telling whether this stroke is using a texture with\n"
|
|
||||||
" tips or not.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iTips: True if this stroke uses a texture with tips.\n"
|
|
||||||
" :type iTips: bool\n";
|
|
||||||
|
|
||||||
static PyObject *Stroke_setTips( BPy_Stroke *self , PyObject *args) {
|
|
||||||
PyObject *py_b;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O", &py_b) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->s->setTips( bool_from_PyBool(py_b) );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char Stroke_strokeVerticesBegin___doc__[] =
|
|
||||||
".. method:: strokeVerticesBegin(t=0.0)\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
" Returns a StrokeVertexIterator pointing on the first StrokeVertex of\n"
|
" Returns a StrokeVertexIterator pointing on the first StrokeVertex of\n"
|
||||||
" the Stroke. O ne can specify a sampling value to resample the Stroke\n"
|
" the Stroke. O ne can specify a sampling value to resample the Stroke\n"
|
||||||
@@ -392,81 +232,181 @@ static char Stroke_strokeVerticesBegin___doc__[] =
|
|||||||
" resampled. If 0 is specified, no resampling is done.\n"
|
" resampled. If 0 is specified, no resampling is done.\n"
|
||||||
" :type t: float\n"
|
" :type t: float\n"
|
||||||
" :return: A StrokeVertexIterator pointing on the first StrokeVertex.\n"
|
" :return: A StrokeVertexIterator pointing on the first StrokeVertex.\n"
|
||||||
" :rtype: :class:`StrokeVertexIterator`\n";
|
" :rtype: :class:`StrokeVertexIterator`");
|
||||||
|
|
||||||
static PyObject * Stroke_strokeVerticesBegin( BPy_Stroke *self , PyObject *args) {
|
static PyObject * Stroke_stroke_vertices_begin( BPy_Stroke *self , PyObject *args)
|
||||||
|
{
|
||||||
float f = 0;
|
float f = 0;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "|f", &f) ))
|
if (!PyArg_ParseTuple(args, "|f", &f))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
StrokeInternal::StrokeVertexIterator sv_it(self->s->strokeVerticesBegin(f));
|
||||||
StrokeInternal::StrokeVertexIterator sv_it( self->s->strokeVerticesBegin(f) );
|
return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, 0);
|
||||||
return BPy_StrokeVertexIterator_from_StrokeVertexIterator( sv_it, 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char Stroke_strokeVerticesEnd___doc__[] =
|
PyDoc_STRVAR(Stroke_stroke_vertices_end_doc,
|
||||||
".. method:: strokeVerticesEnd()\n"
|
".. method:: strokeVerticesEnd()\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Returns a StrokeVertexIterator pointing after the last StrokeVertex\n"
|
" Returns a StrokeVertexIterator pointing after the last StrokeVertex\n"
|
||||||
" of the Stroke.\n"
|
" of the Stroke.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :return: A StrokeVertexIterator pointing after the last StrokeVertex.\n"
|
" :return: A StrokeVertexIterator pointing after the last StrokeVertex.\n"
|
||||||
" :rtype: :class:`StrokeVertexIterator`\n";
|
" :rtype: :class:`StrokeVertexIterator`");
|
||||||
|
|
||||||
static PyObject * Stroke_strokeVerticesEnd( BPy_Stroke *self ) {
|
static PyObject * Stroke_stroke_vertices_end(BPy_Stroke *self)
|
||||||
StrokeInternal::StrokeVertexIterator sv_it( self->s->strokeVerticesEnd() );
|
{
|
||||||
return BPy_StrokeVertexIterator_from_StrokeVertexIterator( sv_it, 1 );
|
StrokeInternal::StrokeVertexIterator sv_it(self->s->strokeVerticesEnd());
|
||||||
|
return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char Stroke_strokeVerticesSize___doc__[] =
|
PyDoc_STRVAR(Stroke_stroke_vertices_size_doc,
|
||||||
".. method:: strokeVerticesSize()\n"
|
".. method:: stroke_vertices_size()\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Returns the number of StrokeVertex constituing the Stroke.\n"
|
" Returns the number of StrokeVertex constituing the Stroke.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :return: The number of stroke vertices.\n"
|
" :return: The number of stroke vertices.\n"
|
||||||
" :rtype: int\n";
|
" :rtype: int");
|
||||||
|
|
||||||
static PyObject * Stroke_strokeVerticesSize( BPy_Stroke *self ) {
|
static PyObject * Stroke_stroke_vertices_size(BPy_Stroke *self)
|
||||||
return PyLong_FromLong( self->s->strokeVerticesSize() );
|
{
|
||||||
|
return PyLong_FromLong(self->s->strokeVerticesSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------Stroke instance definitions ----------------------------*/
|
|
||||||
|
|
||||||
static PyMethodDef BPy_Stroke_methods[] = {
|
static PyMethodDef BPy_Stroke_methods[] = {
|
||||||
{"__getitem__", ( PyCFunction ) Stroke___getitem__, METH_O, "(int i) Returns the i-th StrokeVertex constituting the Stroke."},
|
{"compute_sampling", (PyCFunction)Stroke_compute_sampling, METH_VARARGS, Stroke_compute_sampling_doc},
|
||||||
{"ComputeSampling", ( PyCFunction ) Stroke_ComputeSampling, METH_VARARGS, Stroke_ComputeSampling___doc__},
|
{"resample", (PyCFunction)Stroke_resample, METH_VARARGS, Stroke_resample_doc},
|
||||||
{"Resample", ( PyCFunction ) Stroke_Resample, METH_VARARGS, Stroke_Resample___doc__},
|
{"remove_vertex", (PyCFunction)Stroke_remove_vertex, METH_VARARGS, Stroke_remove_vertex_doc},
|
||||||
{"RemoveVertex", ( PyCFunction ) Stroke_RemoveVertex, METH_VARARGS, Stroke_RemoveVertex___doc__},
|
{"insert_vertex", (PyCFunction)Stroke_insert_vertex, METH_VARARGS, Stroke_insert_vertex_doc},
|
||||||
{"InsertVertex", ( PyCFunction ) Stroke_InsertVertex, METH_VARARGS, Stroke_InsertVertex___doc__},
|
{"update_length", (PyCFunction)Stroke_update_length, METH_NOARGS, Stroke_update_length_doc},
|
||||||
{"UpdateLength", ( PyCFunction ) Stroke_UpdateLength, METH_NOARGS, Stroke_UpdateLength___doc__},
|
{"stroke_vertices_begin", (PyCFunction)Stroke_stroke_vertices_begin, METH_VARARGS, Stroke_stroke_vertices_begin_doc},
|
||||||
{"getLength2D", ( PyCFunction ) Stroke_getLength2D, METH_NOARGS, Stroke_getLength2D___doc__},
|
{"stroke_vertices_end", (PyCFunction)Stroke_stroke_vertices_end, METH_NOARGS, Stroke_stroke_vertices_end_doc},
|
||||||
{"getMediumType", ( PyCFunction ) Stroke_getMediumType, METH_NOARGS, Stroke_getMediumType___doc__},
|
{"stroke_vertices_size", (PyCFunction)Stroke_stroke_vertices_size, METH_NOARGS, Stroke_stroke_vertices_size_doc},
|
||||||
{"getTextureId", ( PyCFunction ) Stroke_getTextureId, METH_NOARGS, Stroke_getTextureId___doc__},
|
|
||||||
{"hasTips", ( PyCFunction ) Stroke_hasTips, METH_NOARGS, Stroke_hasTips___doc__},
|
|
||||||
{"setId", ( PyCFunction ) Stroke_setId, METH_VARARGS, Stroke_setId___doc__},
|
|
||||||
{"setLength", ( PyCFunction ) Stroke_setLength, METH_VARARGS, Stroke_setLength___doc__},
|
|
||||||
{"setMediumType", ( PyCFunction ) Stroke_setMediumType, METH_VARARGS, Stroke_setMediumType___doc__},
|
|
||||||
{"setTextureId", ( PyCFunction ) Stroke_setTextureId, METH_VARARGS, Stroke_setTextureId___doc__},
|
|
||||||
{"setTips", ( PyCFunction ) Stroke_setTips, METH_VARARGS, Stroke_setTips___doc__},
|
|
||||||
{"strokeVerticesBegin", ( PyCFunction ) Stroke_strokeVerticesBegin, METH_VARARGS, Stroke_strokeVerticesBegin___doc__},
|
|
||||||
{"strokeVerticesEnd", ( PyCFunction ) Stroke_strokeVerticesEnd, METH_NOARGS, Stroke_strokeVerticesEnd___doc__},
|
|
||||||
{"strokeVerticesSize", ( PyCFunction ) Stroke_strokeVerticesSize, METH_NOARGS, Stroke_strokeVerticesSize___doc__},
|
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*----------------------Stroke get/setters ----------------------------*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Stroke_medium_type_doc,
|
||||||
|
"The MediumType used for this Stroke.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`MediumType`");
|
||||||
|
|
||||||
|
static PyObject *Stroke_medium_type_get(BPy_Stroke *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return BPy_MediumType_from_MediumType(self->s->getMediumType());
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Stroke_medium_type_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!BPy_MediumType_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be a MediumType");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->s->setMediumType(MediumType_from_BPy_MediumType(value));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Stroke_texture_id_doc,
|
||||||
|
"The ID of the texture used to simulate th marks system for this Stroke.\n"
|
||||||
|
"\n"
|
||||||
|
":type: int");
|
||||||
|
|
||||||
|
static PyObject *Stroke_texture_id_get(BPy_Stroke *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyLong_FromLong( self->s->getTextureId() );
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Stroke_texture_id_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
unsigned int i = PyLong_AsUnsignedLong(value);
|
||||||
|
if(PyErr_Occurred())
|
||||||
|
return -1;
|
||||||
|
self->s->setTextureId(i);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Stroke_tips_doc,
|
||||||
|
"True if this Stroke uses a texture with tips, and false otherwise.\n"
|
||||||
|
"\n"
|
||||||
|
":type: bool");
|
||||||
|
|
||||||
|
static PyObject *Stroke_tips_get(BPy_Stroke *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyBool_from_bool(self->s->hasTips());
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Stroke_tips_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!PyBool_Check(value))
|
||||||
|
return -1;
|
||||||
|
self->s->setTips(bool_from_PyBool(value));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Stroke_length_2d_doc,
|
||||||
|
"The 2D length of the Stroke.\n"
|
||||||
|
"\n"
|
||||||
|
":type: float");
|
||||||
|
|
||||||
|
static PyObject *Stroke_length_2d_get(BPy_Stroke *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyFloat_FromDouble(self->s->getLength2D());
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Stroke_length_2d_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
float scalar;
|
||||||
|
if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be a number");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->s->setLength(scalar);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Stroke_id_doc,
|
||||||
|
"The Id of this Stroke.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`Id`");
|
||||||
|
|
||||||
|
static PyObject *Stroke_id_get(BPy_Stroke *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
Id id(self->s->getId());
|
||||||
|
return BPy_Id_from_Id(id); // return a copy
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Stroke_id_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!BPy_Id_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be an Id");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->s->setId(*(((BPy_Id *)value)->id));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyGetSetDef BPy_Stroke_getseters[] = {
|
||||||
|
{(char *)"medium_type", (getter)Stroke_medium_type_get, (setter)Stroke_medium_type_set, (char *)Stroke_medium_type_doc, NULL},
|
||||||
|
{(char *)"texture_id", (getter)Stroke_texture_id_get, (setter)Stroke_texture_id_set, (char *)Stroke_texture_id_doc, NULL},
|
||||||
|
{(char *)"tips", (getter)Stroke_tips_get, (setter)Stroke_tips_set, (char *)Stroke_tips_doc, NULL},
|
||||||
|
{(char *)"length_2d", (getter)Stroke_length_2d_get, (setter)Stroke_length_2d_set, (char *)Stroke_length_2d_doc, NULL},
|
||||||
|
{(char *)"id", (getter)Stroke_id_get, (setter)Stroke_id_set, (char *)Stroke_id_doc, NULL},
|
||||||
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||||
|
};
|
||||||
|
|
||||||
/*-----------------------BPy_Stroke type definition ------------------------------*/
|
/*-----------------------BPy_Stroke type definition ------------------------------*/
|
||||||
|
|
||||||
static PySequenceMethods Stroke_as_sequence = {
|
static PySequenceMethods BPy_Stroke_as_sequence = {
|
||||||
(lenfunc)Stroke_length, /* sq_length */
|
(lenfunc)Stroke_sq_length, /* sq_length */
|
||||||
NULL, /* sq_concat */
|
NULL, /* sq_concat */
|
||||||
NULL, /* sq_repeat */
|
NULL, /* sq_repeat */
|
||||||
(ssizeargfunc)Stroke_item, /* sq_item */
|
(ssizeargfunc)Stroke_sq_item, /* sq_item */
|
||||||
NULL, /* sq_slice */
|
NULL, /* sq_slice */
|
||||||
NULL, /* sq_ass_item */
|
NULL, /* sq_ass_item */
|
||||||
NULL, /* sq_ass_slice */
|
NULL, /* *was* sq_ass_slice */
|
||||||
NULL, /* sq_contains */
|
NULL, /* sq_contains */
|
||||||
NULL, /* sq_inplace_concat */
|
NULL, /* sq_inplace_concat */
|
||||||
NULL, /* sq_inplace_repeat */
|
NULL, /* sq_inplace_repeat */
|
||||||
};
|
};
|
||||||
|
|
||||||
PyTypeObject Stroke_Type = {
|
PyTypeObject Stroke_Type = {
|
||||||
@@ -481,7 +421,7 @@ PyTypeObject Stroke_Type = {
|
|||||||
0, /* tp_reserved */
|
0, /* tp_reserved */
|
||||||
0, /* tp_repr */
|
0, /* tp_repr */
|
||||||
0, /* tp_as_number */
|
0, /* tp_as_number */
|
||||||
&Stroke_as_sequence, /* tp_as_sequence */
|
&BPy_Stroke_as_sequence, /* tp_as_sequence */
|
||||||
0, /* tp_as_mapping */
|
0, /* tp_as_mapping */
|
||||||
0, /* tp_hash */
|
0, /* tp_hash */
|
||||||
0, /* tp_call */
|
0, /* tp_call */
|
||||||
@@ -490,22 +430,22 @@ PyTypeObject Stroke_Type = {
|
|||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
Stroke___doc__, /* tp_doc */
|
Stroke_doc, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
0, /* tp_weaklistoffset */
|
0, /* tp_weaklistoffset */
|
||||||
(getiterfunc)Stroke___iter__, /* tp_iter */
|
(getiterfunc)Stroke_iter, /* tp_iter */
|
||||||
0, /* tp_iternext */
|
0, /* tp_iternext */
|
||||||
BPy_Stroke_methods, /* tp_methods */
|
BPy_Stroke_methods, /* tp_methods */
|
||||||
0, /* tp_members */
|
0, /* tp_members */
|
||||||
0, /* tp_getset */
|
BPy_Stroke_getseters, /* tp_getset */
|
||||||
&Interface1D_Type, /* tp_base */
|
&Interface1D_Type, /* tp_base */
|
||||||
0, /* tp_dict */
|
0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
(initproc)Stroke___init__, /* tp_init */
|
(initproc)Stroke_init, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
0, /* tp_new */
|
0, /* tp_new */
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ extern "C" {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//------------------------INSTANCE METHODS ----------------------------------
|
/*----------------------ViewEdge methods ----------------------------*/
|
||||||
|
|
||||||
static char ViewEdge___doc__[] =
|
PyDoc_STRVAR(ViewEdge_doc,
|
||||||
"Class hierarchy: :class:`Interface1D` > :class:`ViewEdge`\n"
|
"Class hierarchy: :class:`Interface1D` > :class:`ViewEdge`\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Class defining a ViewEdge. A ViewEdge in an edge of the image graph.\n"
|
"Class defining a ViewEdge. A ViewEdge in an edge of the image graph.\n"
|
||||||
@@ -32,385 +32,267 @@ static char ViewEdge___doc__[] =
|
|||||||
" Copy constructor.\n"
|
" Copy constructor.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg iBrother: A ViewEdge object.\n"
|
" :arg iBrother: A ViewEdge object.\n"
|
||||||
" :type iBrother: :class:`ViewEdge`\n";
|
" :type iBrother: :class:`ViewEdge`");
|
||||||
|
|
||||||
static int ViewEdge___init__(BPy_ViewEdge *self, PyObject *args, PyObject *kwds)
|
static int ViewEdge_init(BPy_ViewEdge *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
if ( !PyArg_ParseTuple(args, "") )
|
if (!PyArg_ParseTuple(args, ""))
|
||||||
return -1;
|
return -1;
|
||||||
self->ve = new ViewEdge();
|
self->ve = new ViewEdge();
|
||||||
self->py_if1D.if1D = self->ve;
|
self->py_if1D.if1D = self->ve;
|
||||||
self->py_if1D.borrowed = 0;
|
self->py_if1D.borrowed = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char ViewEdge_A___doc__[] =
|
PyDoc_STRVAR(ViewEdge_update_fedges_doc,
|
||||||
".. method:: A()\n"
|
".. method:: update_fedges()\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Returns the first ViewVertex.\n"
|
" Sets Viewedge to this for all embedded fedges.\n");
|
||||||
"\n"
|
|
||||||
" :return: The first ViewVertex.\n"
|
|
||||||
" :rtype: :class:`ViewVertex`\n";
|
|
||||||
|
|
||||||
static PyObject * ViewEdge_A( BPy_ViewEdge *self ) {
|
static PyObject * ViewEdge_update_fedges(BPy_ViewEdge *self)
|
||||||
ViewVertex *v = self->ve->A();
|
{
|
||||||
if( v ){
|
|
||||||
return Any_BPy_ViewVertex_from_ViewVertex( *v );
|
|
||||||
}
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewEdge_B___doc__[] =
|
|
||||||
".. method:: B()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the second ViewVertex.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The second ViewVertex.\n"
|
|
||||||
" :rtype: :class:`ViewVertex`\n";
|
|
||||||
|
|
||||||
static PyObject * ViewEdge_B( BPy_ViewEdge *self ) {
|
|
||||||
ViewVertex *v = self->ve->B();
|
|
||||||
if( v ){
|
|
||||||
return Any_BPy_ViewVertex_from_ViewVertex( *v );
|
|
||||||
}
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewEdge_fedgeA___doc__[] =
|
|
||||||
".. method:: fedgeA()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the first FEdge that constitutes this ViewEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The first FEdge constituting this ViewEdge.\n"
|
|
||||||
" :rtype: :class:`FEdge`\n";
|
|
||||||
|
|
||||||
static PyObject * ViewEdge_fedgeA( BPy_ViewEdge *self ) {
|
|
||||||
FEdge *A = self->ve->fedgeA();
|
|
||||||
if( A ){
|
|
||||||
return Any_BPy_FEdge_from_FEdge( *A );
|
|
||||||
}
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewEdge_fedgeB___doc__[] =
|
|
||||||
".. method:: fedgeB()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the last FEdge that constitutes this ViewEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The last FEdge constituting this ViewEdge.\n"
|
|
||||||
" :rtype: :class:`FEdge`\n";
|
|
||||||
|
|
||||||
static PyObject * ViewEdge_fedgeB( BPy_ViewEdge *self ) {
|
|
||||||
FEdge *B = self->ve->fedgeB();
|
|
||||||
if( B ){
|
|
||||||
return Any_BPy_FEdge_from_FEdge( *B );
|
|
||||||
}
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewEdge_viewShape___doc__[] =
|
|
||||||
".. method:: viewShape()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the ViewShape to which this ViewEdge belongs to.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The ViewShape to which this ViewEdge belongs to.\n"
|
|
||||||
" :rtype: :class:`ViewShape`\n";
|
|
||||||
|
|
||||||
static PyObject * ViewEdge_viewShape( BPy_ViewEdge *self ) {
|
|
||||||
ViewShape *vs = self->ve->viewShape();
|
|
||||||
if( vs ){
|
|
||||||
return BPy_ViewShape_from_ViewShape( *vs );
|
|
||||||
}
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewEdge_aShape___doc__[] =
|
|
||||||
".. method:: aShape()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the shape that is occluded by the ViewShape to which this\n"
|
|
||||||
" ViewEdge belongs to. If no object is occluded, None is returned.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The occluded ViewShape.\n"
|
|
||||||
" :rtype: :class:`ViewShape`\n";
|
|
||||||
|
|
||||||
static PyObject * ViewEdge_aShape( BPy_ViewEdge *self ) {
|
|
||||||
ViewShape *vs = self->ve->aShape();
|
|
||||||
if( vs ){
|
|
||||||
return BPy_ViewShape_from_ViewShape( *vs );
|
|
||||||
}
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewEdge_isClosed___doc__[] =
|
|
||||||
".. method:: isClosed()\n"
|
|
||||||
"\n"
|
|
||||||
" Tells whether this ViewEdge forms a closed loop or not.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: True if this ViewEdge forms a closed loop.\n"
|
|
||||||
" :rtype: bool\n";
|
|
||||||
|
|
||||||
static PyObject * ViewEdge_isClosed( BPy_ViewEdge *self ) {
|
|
||||||
return PyBool_from_bool( self->ve->isClosed() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewEdge_getChainingTimeStamp___doc__[] =
|
|
||||||
".. method:: getChainingTimeStamp()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the time stamp of this ViewEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The time stamp.\n"
|
|
||||||
" :rtype: int\n";
|
|
||||||
|
|
||||||
static PyObject * ViewEdge_getChainingTimeStamp( BPy_ViewEdge *self ) {
|
|
||||||
return PyLong_FromLong( self->ve->getChainingTimeStamp() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewEdge_setChainingTimeStamp___doc__[] =
|
|
||||||
".. method:: setChainingTimeStamp(ts)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the time stamp value.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg ts: The time stamp.\n"
|
|
||||||
" :type ts: int\n";
|
|
||||||
|
|
||||||
static PyObject * ViewEdge_setChainingTimeStamp( BPy_ViewEdge *self, PyObject *args) {
|
|
||||||
int timestamp = 0 ;
|
|
||||||
|
|
||||||
if( !PyArg_ParseTuple(args, "i", ×tamp) )
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->ve->setChainingTimeStamp( timestamp );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewEdge_setA___doc__[] =
|
|
||||||
".. method:: setA(iA)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the first ViewVertex of the ViewEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iA: The first ViewVertex of the ViewEdge.\n"
|
|
||||||
" :type iA: :class:`ViewVertex`\n";
|
|
||||||
|
|
||||||
static PyObject *ViewEdge_setA( BPy_ViewEdge *self , PyObject *args) {
|
|
||||||
PyObject *py_vv;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &ViewVertex_Type, &py_vv) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->ve->setA( ((BPy_ViewVertex *) py_vv)->vv );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewEdge_setB___doc__[] =
|
|
||||||
".. method:: setB(iB)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the last ViewVertex of the ViewEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iB: The last ViewVertex of the ViewEdge.\n"
|
|
||||||
" :type iB: :class:`ViewVertex`\n";
|
|
||||||
|
|
||||||
static PyObject *ViewEdge_setB( BPy_ViewEdge *self , PyObject *args) {
|
|
||||||
PyObject *py_vv;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &ViewVertex_Type, &py_vv) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->ve->setB( ((BPy_ViewVertex *) py_vv)->vv );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewEdge_setNature___doc__[] =
|
|
||||||
".. method:: setNature(iNature)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the nature of the ViewEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iNature: The nature of the ViewEdge.\n"
|
|
||||||
" :type iNature: :class:`Nature`\n";
|
|
||||||
|
|
||||||
static PyObject * ViewEdge_setNature( BPy_ViewEdge *self, PyObject *args ) {
|
|
||||||
PyObject *py_n;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &Nature_Type, &py_n) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
PyObject *i = (PyObject *) &( ((BPy_Nature *) py_n)->i );
|
|
||||||
self->ve->setNature( PyLong_AsLong(i) );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewEdge_setFEdgeA___doc__[] =
|
|
||||||
".. method:: setFEdgeA(iFEdge)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the first FEdge of the ViewEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iFEdge: The first FEdge of the ViewEdge.\n"
|
|
||||||
" :type iFEdge: :class:`FEdge`\n";
|
|
||||||
|
|
||||||
static PyObject * ViewEdge_setFEdgeA( BPy_ViewEdge *self, PyObject *args ) {
|
|
||||||
PyObject *py_fe;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->ve->setFEdgeA( ((BPy_FEdge *) py_fe)->fe );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewEdge_setFEdgeB___doc__[] =
|
|
||||||
".. method:: setFEdgeB(iFEdge)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the last FEdge of the ViewEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iFEdge: The last FEdge of the ViewEdge.\n"
|
|
||||||
" :type iFEdge: :class:`FEdge`\n";
|
|
||||||
|
|
||||||
static PyObject * ViewEdge_setFEdgeB( BPy_ViewEdge *self, PyObject *args ) {
|
|
||||||
PyObject *py_fe;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->ve->setFEdgeB( ((BPy_FEdge *) py_fe)->fe );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewEdge_setShape___doc__[] =
|
|
||||||
".. method:: setShape(iVShape)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the ViewShape to which this ViewEdge belongs to.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iVShape: The ViewShape to which this ViewEdge belongs to.\n"
|
|
||||||
" :type iVShape: :class:`ViewShape`\n";
|
|
||||||
|
|
||||||
static PyObject * ViewEdge_setShape( BPy_ViewEdge *self, PyObject *args ) {
|
|
||||||
PyObject *py_vs;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O", &ViewShape_Type, &py_vs) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->ve->setShape( ((BPy_ViewShape *) py_vs)->vs );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewEdge_setId___doc__[] =
|
|
||||||
".. method:: setId(id)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the ViewEdge id.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg id: An Id object.\n"
|
|
||||||
" :type id: :class:`Id`\n";
|
|
||||||
|
|
||||||
static PyObject * ViewEdge_setId( BPy_ViewEdge *self, PyObject *args ) {
|
|
||||||
PyObject *py_id;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &Id_Type, &py_id) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
Id id(*( ((BPy_Id *) py_id)->id ));
|
|
||||||
self->ve->setId( id );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char ViewEdge_UpdateFEdges___doc__[] =
|
|
||||||
".. method:: UpdateFEdges()\n"
|
|
||||||
"\n"
|
|
||||||
" Sets Viewedge to this for all embedded fedges.\n";
|
|
||||||
|
|
||||||
static PyObject * ViewEdge_UpdateFEdges( BPy_ViewEdge *self ) {
|
|
||||||
self->ve->UpdateFEdges();
|
self->ve->UpdateFEdges();
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char ViewEdge_setaShape___doc__[] =
|
static PyMethodDef BPy_ViewEdge_methods[] = {
|
||||||
".. method:: setaShape(iShape)\n"
|
{"update_fedges", (PyCFunction)ViewEdge_update_fedges, METH_NOARGS, ViewEdge_update_fedges_doc},
|
||||||
|
{NULL, NULL, 0, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*----------------------ViewEdge get/setters ----------------------------*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(ViewEdge_first_viewvertex_doc,
|
||||||
|
"The first ViewVertex.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Sets the occluded ViewShape.\n"
|
":type: :class:`ViewVertex`");
|
||||||
"\n"
|
|
||||||
" :arg iShape: A ViewShape object.\n"
|
|
||||||
" :type iShape: :class:`ViewShape`\n";
|
|
||||||
|
|
||||||
static PyObject * ViewEdge_setaShape( BPy_ViewEdge *self, PyObject *args ) {
|
|
||||||
PyObject *py_vs;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O!", &ViewShape_Type, &py_vs) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
ViewShape *vs = ((BPy_ViewShape *) py_vs)->vs;
|
|
||||||
self->ve->setaShape( vs );
|
|
||||||
|
|
||||||
|
static PyObject *ViewEdge_first_viewvertex_get(BPy_ViewEdge *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
ViewVertex *v = self->ve->A();
|
||||||
|
if (v)
|
||||||
|
return Any_BPy_ViewVertex_from_ViewVertex(*v);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char ViewEdge_setQI___doc__[] =
|
static int ViewEdge_first_viewvertex_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
|
||||||
".. method:: setQI(qi)\n"
|
{
|
||||||
"\n"
|
if(!BPy_ViewVertex_Check(value))
|
||||||
" Sets the quantitative invisibility value of the ViewEdge.\n"
|
return -1;
|
||||||
"\n"
|
self->ve->setA(((BPy_ViewVertex *)value)->vv);
|
||||||
" :arg qi: The quantitative invisibility.\n"
|
return 0;
|
||||||
" :type qi: int\n";
|
}
|
||||||
|
|
||||||
static PyObject * ViewEdge_setQI( BPy_ViewEdge *self, PyObject *args ) {
|
PyDoc_STRVAR(ViewEdge_last_viewvertex_doc,
|
||||||
|
"The second ViewVertex.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`ViewVertex`");
|
||||||
|
|
||||||
|
static PyObject *ViewEdge_last_viewvertex_get(BPy_ViewEdge *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
ViewVertex *v = self->ve->B();
|
||||||
|
if (v)
|
||||||
|
return Any_BPy_ViewVertex_from_ViewVertex(*v);
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ViewEdge_last_viewvertex_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if(!BPy_ViewVertex_Check(value))
|
||||||
|
return -1;
|
||||||
|
self->ve->setB(((BPy_ViewVertex *)value)->vv);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(ViewEdge_first_fedge_doc,
|
||||||
|
"The first FEdge that constitutes this ViewEdge.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`FEdge`");
|
||||||
|
|
||||||
|
static PyObject *ViewEdge_first_fedge_get(BPy_ViewEdge *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
FEdge *fe = self->ve->fedgeA();
|
||||||
|
if (fe)
|
||||||
|
return Any_BPy_FEdge_from_FEdge(*fe);
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ViewEdge_first_fedge_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if(!BPy_FEdge_Check(value))
|
||||||
|
return -1;
|
||||||
|
self->ve->setFEdgeA(((BPy_FEdge *)value)->fe);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(ViewEdge_last_fedge_doc,
|
||||||
|
"The last FEdge that constitutes this ViewEdge.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`FEdge`");
|
||||||
|
|
||||||
|
static PyObject *ViewEdge_last_fedge_get(BPy_ViewEdge *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
FEdge *fe = self->ve->fedgeB();
|
||||||
|
if (fe)
|
||||||
|
return Any_BPy_FEdge_from_FEdge(*fe);
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ViewEdge_last_fedge_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if(!BPy_FEdge_Check(value))
|
||||||
|
return -1;
|
||||||
|
self->ve->setFEdgeB(((BPy_FEdge *)value)->fe);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(ViewEdge_viewshape_doc,
|
||||||
|
"The ViewShape to which this ViewEdge belongs to.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`ViewShape`");
|
||||||
|
|
||||||
|
static PyObject *ViewEdge_viewshape_get(BPy_ViewEdge *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
ViewShape *vs = self->ve->viewShape();
|
||||||
|
if (vs)
|
||||||
|
return BPy_ViewShape_from_ViewShape(*vs);
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ViewEdge_viewshape_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!BPy_ViewShape_Check(value))
|
||||||
|
return -1;
|
||||||
|
self->ve->setShape(((BPy_ViewShape *)value)->vs);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(ViewEdge_occludee_doc,
|
||||||
|
"The shape that is occluded by the ViewShape to which this ViewEdge\n"
|
||||||
|
"belongs to. If no object is occluded, this property is set to None.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`ViewShape`");
|
||||||
|
|
||||||
|
static PyObject *ViewEdge_occludee_get(BPy_ViewEdge *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
ViewShape *vs = self->ve->aShape();
|
||||||
|
if (vs)
|
||||||
|
return BPy_ViewShape_from_ViewShape(*vs);
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ViewEdge_occludee_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if(!BPy_ViewShape_Check(value))
|
||||||
|
return -1;
|
||||||
|
self->ve->setaShape(((BPy_ViewShape *)value)->vs);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(ViewEdge_is_closed_doc,
|
||||||
|
"True if this ViewEdge forms a closed loop.\n"
|
||||||
|
"\n"
|
||||||
|
":type: bool");
|
||||||
|
|
||||||
|
static PyObject *ViewEdge_is_closed_get(BPy_ViewEdge *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyBool_from_bool(self->ve->isClosed());
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(ViewEdge_id_doc,
|
||||||
|
"The Id of this ViewEdge.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`Id`");
|
||||||
|
|
||||||
|
static PyObject *ViewEdge_id_get(BPy_ViewEdge *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
Id id(self->ve->getId());
|
||||||
|
return BPy_Id_from_Id(id); // return a copy
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ViewEdge_id_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!BPy_Id_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be an Id");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->ve->setId(*(((BPy_Id *)value)->id));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(ViewEdge_nature_doc,
|
||||||
|
"The nature of this ViewEdge.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`Nature`");
|
||||||
|
|
||||||
|
static PyObject *ViewEdge_nature_get(BPy_ViewEdge *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return BPy_Nature_from_Nature(self->ve->getNature());
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ViewEdge_nature_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if (!BPy_Nature_Check(value)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "value must be a Nature");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
self->ve->setNature(PyLong_AsLong((PyObject *)&((BPy_Nature *)value)->i));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(ViewEdge_qi_doc,
|
||||||
|
"The quantitative invisibility.\n"
|
||||||
|
"\n"
|
||||||
|
":type: int");
|
||||||
|
|
||||||
|
static PyObject *ViewEdge_qi_get(BPy_ViewEdge *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyLong_FromLong(self->ve->qi());
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ViewEdge_qi_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
int qi;
|
int qi;
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "i", &qi) ))
|
if((qi = PyLong_AsLong(value)) == -1 && PyErr_Occurred())
|
||||||
return NULL;
|
return -1;
|
||||||
|
self->ve->setQI(qi);
|
||||||
self->ve->setQI( qi );
|
return 0;
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char ViewEdge_qi___doc__[] =
|
PyDoc_STRVAR(ViewEdge_chaining_time_stamp_doc,
|
||||||
".. method:: getChainingTimeStamp()\n"
|
"The time stamp of this ViewEdge.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Returns the quantitative invisibility value of the ViewEdge.\n"
|
":type: int");
|
||||||
"\n"
|
|
||||||
" :return: The quantitative invisibility.\n"
|
|
||||||
" :rtype: int\n";
|
|
||||||
|
|
||||||
static PyObject * ViewEdge_qi( BPy_ViewEdge *self ) {
|
static PyObject *ViewEdge_chaining_time_stamp_get(BPy_ViewEdge *self, void *UNUSED(closure))
|
||||||
return PyLong_FromLong( self->ve->qi() );
|
{
|
||||||
|
return PyLong_FromLong(self->ve->getChainingTimeStamp());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------ViewEdge instance definitions ----------------------------*/
|
static int ViewEdge_chaining_time_stamp_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
|
||||||
static PyMethodDef BPy_ViewEdge_methods[] = {
|
{
|
||||||
{"A", ( PyCFunction ) ViewEdge_A, METH_NOARGS, ViewEdge_A___doc__},
|
int timestamp;
|
||||||
{"B", ( PyCFunction ) ViewEdge_B, METH_NOARGS, ViewEdge_B___doc__},
|
|
||||||
{"fedgeA", ( PyCFunction ) ViewEdge_fedgeA, METH_NOARGS, ViewEdge_fedgeA___doc__},
|
if ((timestamp = PyLong_AsLong(value)) == -1 && PyErr_Occurred())
|
||||||
{"fedgeB", ( PyCFunction ) ViewEdge_fedgeB, METH_NOARGS, ViewEdge_fedgeB___doc__},
|
return -1;
|
||||||
{"viewShape", ( PyCFunction ) ViewEdge_viewShape, METH_NOARGS, ViewEdge_viewShape___doc__},
|
self->ve->setChainingTimeStamp(timestamp);
|
||||||
{"aShape", ( PyCFunction ) ViewEdge_aShape, METH_NOARGS, ViewEdge_aShape___doc__},
|
return 0;
|
||||||
{"isClosed", ( PyCFunction ) ViewEdge_isClosed, METH_NOARGS, ViewEdge_isClosed___doc__},
|
}
|
||||||
{"getChainingTimeStamp", ( PyCFunction ) ViewEdge_getChainingTimeStamp, METH_NOARGS, ViewEdge_getChainingTimeStamp___doc__},
|
|
||||||
{"setChainingTimeStamp", ( PyCFunction ) ViewEdge_setChainingTimeStamp, METH_VARARGS, ViewEdge_setChainingTimeStamp___doc__},
|
static PyGetSetDef BPy_ViewEdge_getseters[] = {
|
||||||
{"setA", ( PyCFunction ) ViewEdge_setA, METH_VARARGS, ViewEdge_setA___doc__},
|
{(char *)"first_viewvertex", (getter)ViewEdge_first_viewvertex_get, (setter)ViewEdge_first_viewvertex_set, (char *)ViewEdge_first_viewvertex_doc, NULL},
|
||||||
{"setB", ( PyCFunction ) ViewEdge_setB, METH_VARARGS, ViewEdge_setB___doc__},
|
{(char *)"last_viewvertex", (getter)ViewEdge_last_viewvertex_get, (setter)ViewEdge_last_viewvertex_set, (char *)ViewEdge_last_viewvertex_doc, NULL},
|
||||||
{"setNature", ( PyCFunction ) ViewEdge_setNature, METH_VARARGS, ViewEdge_setNature___doc__},
|
{(char *)"first_fedge", (getter)ViewEdge_first_fedge_get, (setter)ViewEdge_first_fedge_set, (char *)ViewEdge_first_fedge_doc, NULL},
|
||||||
{"setFEdgeA", ( PyCFunction ) ViewEdge_setFEdgeA, METH_VARARGS, ViewEdge_setFEdgeA___doc__},
|
{(char *)"last_fedge", (getter)ViewEdge_last_fedge_get, (setter)ViewEdge_last_fedge_set, (char *)ViewEdge_last_fedge_doc, NULL},
|
||||||
{"setFEdgeB", ( PyCFunction ) ViewEdge_setFEdgeB, METH_VARARGS, ViewEdge_setFEdgeB___doc__},
|
{(char *)"viewshape", (getter)ViewEdge_viewshape_get, (setter)ViewEdge_viewshape_set, (char *)ViewEdge_viewshape_doc, NULL},
|
||||||
{"setShape", ( PyCFunction ) ViewEdge_setShape, METH_VARARGS, ViewEdge_setShape___doc__},
|
{(char *)"occludee", (getter)ViewEdge_occludee_get, (setter)ViewEdge_occludee_set, (char *)ViewEdge_occludee_doc, NULL},
|
||||||
{"setId", ( PyCFunction ) ViewEdge_setId, METH_VARARGS, ViewEdge_setId___doc__},
|
{(char *)"is_closed", (getter)ViewEdge_is_closed_get, (setter)NULL, (char *)ViewEdge_is_closed_doc, NULL},
|
||||||
{"UpdateFEdges", ( PyCFunction ) ViewEdge_UpdateFEdges, METH_NOARGS, ViewEdge_UpdateFEdges___doc__},
|
{(char *)"id", (getter)ViewEdge_id_get, (setter)ViewEdge_id_set, (char *)ViewEdge_id_doc, NULL},
|
||||||
{"setaShape", ( PyCFunction ) ViewEdge_setaShape, METH_VARARGS, ViewEdge_setaShape___doc__},
|
{(char *)"nature", (getter)ViewEdge_nature_get, (setter)ViewEdge_nature_set, (char *)ViewEdge_nature_doc, NULL},
|
||||||
{"setQI", ( PyCFunction ) ViewEdge_setQI, METH_VARARGS, ViewEdge_setQI___doc__},
|
{(char *)"qi", (getter)ViewEdge_qi_get, (setter)ViewEdge_qi_set, (char *)ViewEdge_qi_doc, NULL},
|
||||||
{"qi", ( PyCFunction ) ViewEdge_qi, METH_NOARGS, ViewEdge_qi___doc__},
|
{(char *)"chaining_time_stamp", (getter)ViewEdge_chaining_time_stamp_get, (setter)ViewEdge_chaining_time_stamp_set, (char *)ViewEdge_chaining_time_stamp_doc, NULL},
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-----------------------BPy_ViewEdge type definition ------------------------------*/
|
/*-----------------------BPy_ViewEdge type definition ------------------------------*/
|
||||||
@@ -436,7 +318,7 @@ PyTypeObject ViewEdge_Type = {
|
|||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
ViewEdge___doc__, /* tp_doc */
|
ViewEdge_doc, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
@@ -445,13 +327,13 @@ PyTypeObject ViewEdge_Type = {
|
|||||||
0, /* tp_iternext */
|
0, /* tp_iternext */
|
||||||
BPy_ViewEdge_methods, /* tp_methods */
|
BPy_ViewEdge_methods, /* tp_methods */
|
||||||
0, /* tp_members */
|
0, /* tp_members */
|
||||||
0, /* tp_getset */
|
BPy_ViewEdge_getseters, /* tp_getset */
|
||||||
&Interface1D_Type, /* tp_base */
|
&Interface1D_Type, /* tp_base */
|
||||||
0, /* tp_dict */
|
0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
(initproc)ViewEdge___init__, /* tp_init */
|
(initproc)ViewEdge_init, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
0, /* tp_new */
|
0, /* tp_new */
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ extern "C" {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//------------------------INSTANCE METHODS ----------------------------------
|
/*----------------------FEdgeSharp methods ----------------------------*/
|
||||||
|
|
||||||
static char FEdgeSharp___doc__[] =
|
PyDoc_STRVAR(FEdgeSharp_doc,
|
||||||
"Class hierarchy: :class:`Interface1D` > :class:`FEdge` > :class:`FEdgeSharp`\n"
|
"Class hierarchy: :class:`Interface1D` > :class:`FEdge` > :class:`FEdgeSharp`\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Class defining a sharp FEdge. A Sharp FEdge corresponds to an initial\n"
|
"Class defining a sharp FEdge. A Sharp FEdge corresponds to an initial\n"
|
||||||
@@ -39,290 +39,322 @@ static char FEdgeSharp___doc__[] =
|
|||||||
" :arg vA: The first SVertex object.\n"
|
" :arg vA: The first SVertex object.\n"
|
||||||
" :type vA: :class:`SVertex`\n"
|
" :type vA: :class:`SVertex`\n"
|
||||||
" :arg vB: The second SVertex object.\n"
|
" :arg vB: The second SVertex object.\n"
|
||||||
" :type vB: :class:`SVertex`\n";
|
" :type vB: :class:`SVertex`");
|
||||||
|
|
||||||
static int FEdgeSharp___init__(BPy_FEdgeSharp *self, PyObject *args, PyObject *kwds)
|
static int FEdgeSharp_init(BPy_FEdgeSharp *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyObject *obj1 = 0, *obj2 = 0;
|
PyObject *obj1 = 0, *obj2 = 0;
|
||||||
|
|
||||||
if (! PyArg_ParseTuple(args, "|OO", &obj1, &obj2) )
|
if (!PyArg_ParseTuple(args, "|OO", &obj1, &obj2))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( !obj1 ){
|
if (!obj1) {
|
||||||
self->fes = new FEdgeSharp();
|
self->fes = new FEdgeSharp();
|
||||||
|
|
||||||
} else if( !obj2 && BPy_FEdgeSharp_Check(obj1) ) {
|
} else if (!obj2 && BPy_FEdgeSharp_Check(obj1)) {
|
||||||
self->fes = new FEdgeSharp(*( ((BPy_FEdgeSharp *) obj1)->fes ));
|
self->fes = new FEdgeSharp(*(((BPy_FEdgeSharp *)obj1)->fes));
|
||||||
|
|
||||||
} else if( obj2 && BPy_SVertex_Check(obj1) && BPy_SVertex_Check(obj2) ) {
|
} else if (obj2 && BPy_SVertex_Check(obj1) && BPy_SVertex_Check(obj2)) {
|
||||||
self->fes = new FEdgeSharp( ((BPy_SVertex *) obj1)->sv, ((BPy_SVertex *) obj2)->sv );
|
self->fes = new FEdgeSharp(((BPy_SVertex *)obj1)->sv, ((BPy_SVertex *)obj2)->sv);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
|
PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->py_fe.fe = self->fes;
|
self->py_fe.fe = self->fes;
|
||||||
self->py_fe.py_if1D.if1D = self->fes;
|
self->py_fe.py_if1D.if1D = self->fes;
|
||||||
self->py_fe.py_if1D.borrowed = 0;
|
self->py_fe.py_if1D.borrowed = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FEdgeSharp_normalA___doc__[] =
|
|
||||||
".. method:: normalA()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the normal to the face lying on the right of the FEdge. If\n"
|
|
||||||
" this FEdge is a border, it has no Face on its right and therefore, no\n"
|
|
||||||
" normal.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The normal to the face lying on the right of the FEdge.\n"
|
|
||||||
" :rtype: :class:`mathutils.Vector`\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSharp_normalA( BPy_FEdgeSharp *self ) {
|
|
||||||
Vec3r v( self->fes->normalA() );
|
|
||||||
return Vector_from_Vec3r( v );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdgeSharp_normalB___doc__[] =
|
|
||||||
".. method:: normalB()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the normal to the face lying on the left of the FEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The normal to the face lying on the left of the FEdge.\n"
|
|
||||||
" :rtype: :class:`mathutils.Vector`\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSharp_normalB( BPy_FEdgeSharp *self ) {
|
|
||||||
Vec3r v( self->fes->normalB() );
|
|
||||||
return Vector_from_Vec3r( v );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdgeSharp_aMaterialIndex___doc__[] =
|
|
||||||
".. method:: aMaterialIndex()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the index of the material of the face lying on the right of\n"
|
|
||||||
" the FEdge. If this FEdge is a border, it has no Face on its right and\n"
|
|
||||||
" therefore, no material.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The index of the material of the face lying on the right of\n"
|
|
||||||
" the FEdge.\n"
|
|
||||||
" :rtype: int\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSharp_aMaterialIndex( BPy_FEdgeSharp *self ) {
|
|
||||||
return PyLong_FromLong( self->fes->aFrsMaterialIndex() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdgeSharp_bMaterialIndex___doc__[] =
|
|
||||||
".. method:: bMaterialIndex()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the index of the material of the face lying on the left of\n"
|
|
||||||
" the FEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The index of the material of the face lying on the left of\n"
|
|
||||||
" the FEdge.\n"
|
|
||||||
" :rtype: int\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSharp_bMaterialIndex( BPy_FEdgeSharp *self ) {
|
|
||||||
return PyLong_FromLong( self->fes->bFrsMaterialIndex() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdgeSharp_aMaterial___doc__[] =
|
|
||||||
".. method:: aMaterial()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the material of the face lying on the right of the FEdge. If\n"
|
|
||||||
" this FEdge is a border, it has no Face on its right and therefore, no\n"
|
|
||||||
" material.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The material of the face lying on the right of the FEdge.\n"
|
|
||||||
" :rtype: :class:`Material`\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSharp_aMaterial( BPy_FEdgeSharp *self ) {
|
|
||||||
FrsMaterial m( self->fes->aFrsMaterial() );
|
|
||||||
return BPy_FrsMaterial_from_FrsMaterial(m);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdgeSharp_bMaterial___doc__[] =
|
|
||||||
".. method:: bMaterial()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the material of the face lying on the left of the FEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The material of the face lying on the left of the FEdge.\n"
|
|
||||||
" :rtype: :class:`Material`\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSharp_bMaterial( BPy_FEdgeSharp *self ) {
|
|
||||||
FrsMaterial m( self->fes->aFrsMaterial() );
|
|
||||||
return BPy_FrsMaterial_from_FrsMaterial(m);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdgeSharp_aFaceMark___doc__[] =
|
|
||||||
".. method:: aFaceMark()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the face mark of the face lying on the right of the FEdge.\n"
|
|
||||||
" If this FEdge is a border, it has no face on the right, and thus\n"
|
|
||||||
" false is returned.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The face mark of the face lying on the right of the FEdge.\n"
|
|
||||||
" :rtype: bool\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSharp_aFaceMark( BPy_FEdgeSharp *self ) {
|
|
||||||
return PyBool_from_bool( self->fes->aFaceMark() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdgeSharp_bFaceMark___doc__[] =
|
|
||||||
".. method:: bFaceMark()\n"
|
|
||||||
"\n"
|
|
||||||
" Returns the face mark of the face lying on the left of the FEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The face mark of the face lying on the left of the FEdge.\n"
|
|
||||||
" :rtype: bool\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSharp_bFaceMark( BPy_FEdgeSharp *self ) {
|
|
||||||
return PyBool_from_bool( self->fes->bFaceMark() );
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdgeSharp_setNormalA___doc__[] =
|
|
||||||
".. method:: setNormalA(iNormal)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the normal to the face lying on the right of the FEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iNormal: A three-dimensional vector.\n"
|
|
||||||
" :type iNormal: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSharp_setNormalA( BPy_FEdgeSharp *self, PyObject *args ) {
|
|
||||||
PyObject *obj = 0;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O", &obj) ))
|
|
||||||
return NULL;
|
|
||||||
Vec3r *v = Vec3r_ptr_from_PyObject(obj);
|
|
||||||
if( !v ) {
|
|
||||||
PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
self->fes->setNormalA( *v );
|
|
||||||
delete v;
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdgeSharp_setNormalB___doc__[] =
|
|
||||||
".. method:: setNormalB(iNormal)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the normal to the face lying on the left of the FEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg iNormal: A three-dimensional vector.\n"
|
|
||||||
" :type iNormal: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSharp_setNormalB( BPy_FEdgeSharp *self, PyObject *args ) {
|
|
||||||
PyObject *obj = 0;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O", &obj) ))
|
|
||||||
return NULL;
|
|
||||||
Vec3r *v = Vec3r_ptr_from_PyObject(obj);
|
|
||||||
if( !v ) {
|
|
||||||
PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
self->fes->setNormalB( *v );
|
|
||||||
delete v;
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdgeSharp_setaMaterialIndex___doc__[] =
|
|
||||||
".. method:: setaMaterialIndex(i)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the index of the material lying on the right of the FEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg i: A material index.\n"
|
|
||||||
" :type i: int\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSharp_setaMaterialIndex( BPy_FEdgeSharp *self, PyObject *args ) {
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "I", &i) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->fes->setaFrsMaterialIndex( i );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdgeSharp_setbMaterialIndex___doc__[] =
|
|
||||||
".. method:: setbMaterialIndex(i)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the index of the material lying on the left of the FEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg i: A material index.\n"
|
|
||||||
" :type i: int\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSharp_setbMaterialIndex( BPy_FEdgeSharp *self, PyObject *args ) {
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "I", &i) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->fes->setbFrsMaterialIndex( i );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdgeSharp_setaFaceMark___doc__[] =
|
|
||||||
".. method:: setaFaceMark(i)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the face mark of the face lying on the right of the FEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg i: A face mark.\n"
|
|
||||||
" :type i: bool\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSharp_setaFaceMark( BPy_FEdgeSharp *self, PyObject *args ) {
|
|
||||||
PyObject *obj;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O", &obj) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->fes->setaFaceMark( bool_from_PyBool(obj) );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdgeSharp_setbFaceMark___doc__[] =
|
|
||||||
".. method:: setbFaceMark(i)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the face mark of the face lying on the left of the FEdge.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg i: A face mark.\n"
|
|
||||||
" :type i: bool\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSharp_setbFaceMark( BPy_FEdgeSharp *self, PyObject *args ) {
|
|
||||||
PyObject *obj;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O", &obj) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->fes->setbFaceMark( bool_from_PyBool(obj) );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*----------------------FEdgeSharp instance definitions ----------------------------*/
|
|
||||||
static PyMethodDef BPy_FEdgeSharp_methods[] = {
|
static PyMethodDef BPy_FEdgeSharp_methods[] = {
|
||||||
{"normalA", ( PyCFunction ) FEdgeSharp_normalA, METH_NOARGS, FEdgeSharp_normalA___doc__},
|
|
||||||
{"normalB", ( PyCFunction ) FEdgeSharp_normalB, METH_NOARGS, FEdgeSharp_normalB___doc__},
|
|
||||||
{"aMaterialIndex", ( PyCFunction ) FEdgeSharp_aMaterialIndex, METH_NOARGS, FEdgeSharp_aMaterialIndex___doc__},
|
|
||||||
{"bMaterialIndex", ( PyCFunction ) FEdgeSharp_bMaterialIndex, METH_NOARGS, FEdgeSharp_bMaterialIndex___doc__},
|
|
||||||
{"aMaterial", ( PyCFunction ) FEdgeSharp_aMaterial, METH_NOARGS, FEdgeSharp_aMaterial___doc__},
|
|
||||||
{"bMaterial", ( PyCFunction ) FEdgeSharp_bMaterial, METH_NOARGS, FEdgeSharp_bMaterial___doc__},
|
|
||||||
{"aFaceMark", ( PyCFunction ) FEdgeSharp_aFaceMark, METH_NOARGS, FEdgeSharp_aFaceMark___doc__},
|
|
||||||
{"bFaceMark", ( PyCFunction ) FEdgeSharp_bFaceMark, METH_NOARGS, FEdgeSharp_bFaceMark___doc__},
|
|
||||||
{"setNormalA", ( PyCFunction ) FEdgeSharp_setNormalA, METH_VARARGS, FEdgeSharp_setNormalA___doc__},
|
|
||||||
{"setNormalB", ( PyCFunction ) FEdgeSharp_setNormalB, METH_VARARGS, FEdgeSharp_setNormalB___doc__},
|
|
||||||
{"setaMaterialIndex", ( PyCFunction ) FEdgeSharp_setaMaterialIndex, METH_VARARGS, FEdgeSharp_setaMaterialIndex___doc__},
|
|
||||||
{"setbMaterialIndex", ( PyCFunction ) FEdgeSharp_setbMaterialIndex, METH_VARARGS, FEdgeSharp_setbMaterialIndex___doc__},
|
|
||||||
{"setaFaceMark", ( PyCFunction ) FEdgeSharp_setaFaceMark, METH_NOARGS, FEdgeSharp_setaFaceMark___doc__},
|
|
||||||
{"setbFaceMark", ( PyCFunction ) FEdgeSharp_setbFaceMark, METH_NOARGS, FEdgeSharp_setbFaceMark___doc__},
|
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*----------------------mathutils callbacks ----------------------------*/
|
||||||
|
|
||||||
|
/* subtype */
|
||||||
|
#define MATHUTILS_SUBTYPE_NORMAL_A 1
|
||||||
|
#define MATHUTILS_SUBTYPE_NORMAL_B 2
|
||||||
|
|
||||||
|
static int FEdgeSharp_mathutils_check(BaseMathObject *bmo)
|
||||||
|
{
|
||||||
|
if (!BPy_FEdgeSharp_Check(bmo->cb_user))
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FEdgeSharp_mathutils_get(BaseMathObject *bmo, int subtype)
|
||||||
|
{
|
||||||
|
BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user;
|
||||||
|
switch (subtype) {
|
||||||
|
case MATHUTILS_SUBTYPE_NORMAL_A:
|
||||||
|
{
|
||||||
|
Vec3r p(self->fes->normalA());
|
||||||
|
bmo->data[0] = p[0];
|
||||||
|
bmo->data[1] = p[1];
|
||||||
|
bmo->data[2] = p[2];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MATHUTILS_SUBTYPE_NORMAL_B:
|
||||||
|
{
|
||||||
|
Vec3r p(self->fes->normalB());
|
||||||
|
bmo->data[0] = p[0];
|
||||||
|
bmo->data[1] = p[1];
|
||||||
|
bmo->data[2] = p[2];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FEdgeSharp_mathutils_set(BaseMathObject *bmo, int subtype)
|
||||||
|
{
|
||||||
|
BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user;
|
||||||
|
switch (subtype) {
|
||||||
|
case MATHUTILS_SUBTYPE_NORMAL_A:
|
||||||
|
{
|
||||||
|
Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
|
||||||
|
self->fes->setNormalA(p);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MATHUTILS_SUBTYPE_NORMAL_B:
|
||||||
|
{
|
||||||
|
Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
|
||||||
|
self->fes->setNormalB(p);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FEdgeSharp_mathutils_get_index(BaseMathObject *bmo, int subtype, int index)
|
||||||
|
{
|
||||||
|
BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user;
|
||||||
|
switch (subtype) {
|
||||||
|
case MATHUTILS_SUBTYPE_NORMAL_A:
|
||||||
|
{
|
||||||
|
Vec3r p(self->fes->normalA());
|
||||||
|
bmo->data[index] = p[index];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MATHUTILS_SUBTYPE_NORMAL_B:
|
||||||
|
{
|
||||||
|
Vec3r p(self->fes->normalB());
|
||||||
|
bmo->data[index] = p[index];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FEdgeSharp_mathutils_set_index(BaseMathObject *bmo, int subtype, int index)
|
||||||
|
{
|
||||||
|
BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user;
|
||||||
|
switch (subtype) {
|
||||||
|
case MATHUTILS_SUBTYPE_NORMAL_A:
|
||||||
|
{
|
||||||
|
Vec3r p(self->fes->normalA());
|
||||||
|
p[index] = bmo->data[index];
|
||||||
|
self->fes->setNormalA(p);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MATHUTILS_SUBTYPE_NORMAL_B:
|
||||||
|
{
|
||||||
|
Vec3r p(self->fes->normalB());
|
||||||
|
p[index] = bmo->data[index];
|
||||||
|
self->fes->setNormalB(p);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Mathutils_Callback FEdgeSharp_mathutils_cb = {
|
||||||
|
FEdgeSharp_mathutils_check,
|
||||||
|
FEdgeSharp_mathutils_get,
|
||||||
|
FEdgeSharp_mathutils_set,
|
||||||
|
FEdgeSharp_mathutils_get_index,
|
||||||
|
FEdgeSharp_mathutils_set_index
|
||||||
|
};
|
||||||
|
|
||||||
|
static unsigned char FEdgeSharp_mathutils_cb_index = -1;
|
||||||
|
|
||||||
|
void FEdgeSharp_mathutils_register_callback()
|
||||||
|
{
|
||||||
|
FEdgeSharp_mathutils_cb_index = Mathutils_RegisterCallback(&FEdgeSharp_mathutils_cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*----------------------FEdgeSharp get/setters ----------------------------*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FEdgeSharp_normal_right_doc,
|
||||||
|
"The normal to the face lying on the right of the FEdge. If this FEdge\n"
|
||||||
|
"is a border, it has no Face on its right and therefore no normal.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`mathutils.Vector`");
|
||||||
|
|
||||||
|
static PyObject *FEdgeSharp_normal_right_get(BPy_FEdgeSharp *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return Vector_CreatePyObject_cb((PyObject *)self, 3, FEdgeSharp_mathutils_cb_index, MATHUTILS_SUBTYPE_NORMAL_A);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FEdgeSharp_normal_right_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
float v[3];
|
||||||
|
if (!float_array_from_PyObject(value, v, 3)) {
|
||||||
|
PyErr_SetString(PyExc_ValueError, "value must be a 3-dimensional vector");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
Vec3r p(v[0], v[1], v[2]);
|
||||||
|
self->fes->setNormalA(p);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FEdgeSharp_normal_left_doc,
|
||||||
|
"The normal to the face lying on the left of the FEdge.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`mathutils.Vector`");
|
||||||
|
|
||||||
|
static PyObject *FEdgeSharp_normal_left_get(BPy_FEdgeSharp *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return Vector_CreatePyObject_cb((PyObject *)self, 3, FEdgeSharp_mathutils_cb_index, MATHUTILS_SUBTYPE_NORMAL_B);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FEdgeSharp_normal_left_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
float v[3];
|
||||||
|
if (!float_array_from_PyObject(value, v, 3)) {
|
||||||
|
PyErr_SetString(PyExc_ValueError, "value must be a 3-dimensional vector");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
Vec3r p(v[0], v[1], v[2]);
|
||||||
|
self->fes->setNormalB(p);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FEdgeSharp_material_index_right_doc,
|
||||||
|
"The index of the material of the face lying on the right of the FEdge.\n"
|
||||||
|
"If this FEdge is a border, it has no Face on its right and therefore\n"
|
||||||
|
"no material.\n"
|
||||||
|
"\n"
|
||||||
|
":type: int");
|
||||||
|
|
||||||
|
static PyObject *FEdgeSharp_material_index_right_get(BPy_FEdgeSharp *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyLong_FromLong(self->fes->aFrsMaterialIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FEdgeSharp_material_index_right_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
unsigned int i = PyLong_AsUnsignedLong(value);
|
||||||
|
if(PyErr_Occurred())
|
||||||
|
return -1;
|
||||||
|
self->fes->setaFrsMaterialIndex(i);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FEdgeSharp_material_index_left_doc,
|
||||||
|
"The index of the material of the face lying on the left of the FEdge.\n"
|
||||||
|
"\n"
|
||||||
|
":type: int");
|
||||||
|
|
||||||
|
static PyObject *FEdgeSharp_material_index_left_get(BPy_FEdgeSharp *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyLong_FromLong(self->fes->aFrsMaterialIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FEdgeSharp_material_index_left_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
unsigned int i = PyLong_AsUnsignedLong(value);
|
||||||
|
if(PyErr_Occurred())
|
||||||
|
return -1;
|
||||||
|
self->fes->setbFrsMaterialIndex(i);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FEdgeSharp_material_right_doc,
|
||||||
|
"The material of the face lying on the right of the FEdge. If this FEdge\n"
|
||||||
|
"is a border, it has no Face on its right and therefore no material.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`Material`");
|
||||||
|
|
||||||
|
static PyObject *FEdgeSharp_material_right_get(BPy_FEdgeSharp *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
// FIXME aFrsMaterial() returns a const reference.
|
||||||
|
FrsMaterial m(self->fes->aFrsMaterial());
|
||||||
|
return BPy_FrsMaterial_from_FrsMaterial(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FEdgeSharp_material_left_doc,
|
||||||
|
"The material of the face lying on the left of the FEdge.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`Material`");
|
||||||
|
|
||||||
|
static PyObject *FEdgeSharp_material_left_get(BPy_FEdgeSharp *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
// FIXME bFrsMaterial() returns a const reference.
|
||||||
|
FrsMaterial m(self->fes->bFrsMaterial());
|
||||||
|
return BPy_FrsMaterial_from_FrsMaterial(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FEdgeSharp_face_mark_right_doc,
|
||||||
|
"The face mark of the face lying on the right of the FEdge. If this FEdge\n"
|
||||||
|
"is a border, it has no face on the right and thus this property is set to\n"
|
||||||
|
"false.\n"
|
||||||
|
"\n"
|
||||||
|
":type: bool");
|
||||||
|
|
||||||
|
static PyObject *FEdgeSharp_face_mark_right_get(BPy_FEdgeSharp *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyBool_from_bool(self->fes->aFaceMark());
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FEdgeSharp_face_mark_right_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if(!PyBool_Check(value))
|
||||||
|
return -1;
|
||||||
|
self->fes->setaFaceMark(bool_from_PyBool(value));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FEdgeSharp_face_mark_left_doc,
|
||||||
|
"The face mark of the face lying on the left of the FEdge.\n"
|
||||||
|
"\n"
|
||||||
|
":type: bool");
|
||||||
|
|
||||||
|
static PyObject *FEdgeSharp_face_mark_left_get(BPy_FEdgeSharp *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyBool_from_bool(self->fes->bFaceMark());
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FEdgeSharp_face_mark_left_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
if(!PyBool_Check(value))
|
||||||
|
return -1;
|
||||||
|
self->fes->setbFaceMark(bool_from_PyBool(value));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyGetSetDef BPy_FEdgeSharp_getseters[] = {
|
||||||
|
{(char *)"normal_right", (getter)FEdgeSharp_normal_right_get, (setter)FEdgeSharp_normal_right_set, (char *)FEdgeSharp_normal_right_doc, NULL},
|
||||||
|
{(char *)"normal_left", (getter)FEdgeSharp_normal_left_get, (setter)FEdgeSharp_normal_left_set, (char *)FEdgeSharp_normal_left_doc, NULL},
|
||||||
|
{(char *)"material_index_right", (getter)FEdgeSharp_material_index_right_get, (setter)FEdgeSharp_material_index_right_set, (char *)FEdgeSharp_material_index_right_doc, NULL},
|
||||||
|
{(char *)"material_index_left", (getter)FEdgeSharp_material_index_left_get, (setter)FEdgeSharp_material_index_left_set, (char *)FEdgeSharp_material_index_left_doc, NULL},
|
||||||
|
{(char *)"material_right", (getter)FEdgeSharp_material_right_get, (setter)NULL, (char *)FEdgeSharp_material_right_doc, NULL},
|
||||||
|
{(char *)"material_left", (getter)FEdgeSharp_material_left_get, (setter)NULL, (char *)FEdgeSharp_material_left_doc, NULL},
|
||||||
|
{(char *)"face_mark_right", (getter)FEdgeSharp_face_mark_right_get, (setter)FEdgeSharp_face_mark_right_set, (char *)FEdgeSharp_face_mark_right_doc, NULL},
|
||||||
|
{(char *)"face_mark_left", (getter)FEdgeSharp_face_mark_left_get, (setter)FEdgeSharp_face_mark_left_set, (char *)FEdgeSharp_face_mark_left_doc, NULL},
|
||||||
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||||
|
};
|
||||||
|
|
||||||
/*-----------------------BPy_FEdgeSharp type definition ------------------------------*/
|
/*-----------------------BPy_FEdgeSharp type definition ------------------------------*/
|
||||||
|
|
||||||
PyTypeObject FEdgeSharp_Type = {
|
PyTypeObject FEdgeSharp_Type = {
|
||||||
@@ -346,7 +378,7 @@ PyTypeObject FEdgeSharp_Type = {
|
|||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
FEdgeSharp___doc__, /* tp_doc */
|
FEdgeSharp_doc, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
@@ -355,13 +387,13 @@ PyTypeObject FEdgeSharp_Type = {
|
|||||||
0, /* tp_iternext */
|
0, /* tp_iternext */
|
||||||
BPy_FEdgeSharp_methods, /* tp_methods */
|
BPy_FEdgeSharp_methods, /* tp_methods */
|
||||||
0, /* tp_members */
|
0, /* tp_members */
|
||||||
0, /* tp_getset */
|
BPy_FEdgeSharp_getseters, /* tp_getset */
|
||||||
&FEdge_Type, /* tp_base */
|
&FEdge_Type, /* tp_base */
|
||||||
0, /* tp_dict */
|
0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
(initproc)FEdgeSharp___init__, /* tp_init */
|
(initproc)FEdgeSharp_init, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
0, /* tp_new */
|
0, /* tp_new */
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ typedef struct {
|
|||||||
FEdgeSharp *fes;
|
FEdgeSharp *fes;
|
||||||
} BPy_FEdgeSharp;
|
} BPy_FEdgeSharp;
|
||||||
|
|
||||||
|
/*---------------------------Python BPy_FEdgeSharp visible prototypes-----------*/
|
||||||
|
|
||||||
|
void FEdgeSharp_mathutils_register_callback();
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ extern "C" {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//------------------------INSTANCE METHODS ----------------------------------
|
/*----------------------FEdgeSmooth methods ----------------------------*/
|
||||||
|
|
||||||
static char FEdgeSmooth___doc__[] =
|
PyDoc_STRVAR(FEdgeSmooth_doc,
|
||||||
"Class hierarchy: :class:`Interface1D` > :class:`FEdge` > :class:`FEdgeSmooth`\n"
|
"Class hierarchy: :class:`Interface1D` > :class:`FEdge` > :class:`FEdgeSmooth`\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Class defining a smooth edge. This kind of edge typically runs across\n"
|
"Class defining a smooth edge. This kind of edge typically runs across\n"
|
||||||
@@ -36,23 +36,23 @@ static char FEdgeSmooth___doc__[] =
|
|||||||
" :arg vA: The first SVertex object.\n"
|
" :arg vA: The first SVertex object.\n"
|
||||||
" :type vA: :class:`SVertex`\n"
|
" :type vA: :class:`SVertex`\n"
|
||||||
" :arg vB: The second SVertex object.\n"
|
" :arg vB: The second SVertex object.\n"
|
||||||
" :type vB: :class:`SVertex`\n";
|
" :type vB: :class:`SVertex`");
|
||||||
|
|
||||||
static int FEdgeSmooth___init__(BPy_FEdgeSmooth *self, PyObject *args, PyObject *kwds)
|
static int FEdgeSmooth_init(BPy_FEdgeSmooth *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyObject *obj1 = 0, *obj2 = 0;
|
PyObject *obj1 = 0, *obj2 = 0;
|
||||||
|
|
||||||
if (! PyArg_ParseTuple(args, "|OO", &obj1, &obj2) )
|
if (!PyArg_ParseTuple(args, "|OO", &obj1, &obj2))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( !obj1 ){
|
if (!obj1) {
|
||||||
self->fes = new FEdgeSmooth();
|
self->fes = new FEdgeSmooth();
|
||||||
|
|
||||||
} else if( !obj2 && BPy_FEdgeSmooth_Check(obj1) ) {
|
} else if (!obj2 && BPy_FEdgeSmooth_Check(obj1)) {
|
||||||
self->fes = new FEdgeSmooth(*( ((BPy_FEdgeSmooth *) obj1)->fes ));
|
self->fes = new FEdgeSmooth(*(((BPy_FEdgeSmooth *)obj1)->fes));
|
||||||
|
|
||||||
} else if( obj2 && BPy_SVertex_Check(obj1) && BPy_SVertex_Check(obj2) ) {
|
} else if (obj2 && BPy_SVertex_Check(obj1) && BPy_SVertex_Check(obj2)) {
|
||||||
self->fes = new FEdgeSmooth( ((BPy_SVertex *) obj1)->sv, ((BPy_SVertex *) obj2)->sv );
|
self->fes = new FEdgeSmooth(((BPy_SVertex *)obj1)->sv, ((BPy_SVertex *)obj2)->sv);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
|
PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
|
||||||
@@ -66,128 +66,148 @@ static int FEdgeSmooth___init__(BPy_FEdgeSmooth *self, PyObject *args, PyObject
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FEdgeSmooth_normal___doc__[] =
|
static PyMethodDef BPy_FEdgeSmooth_methods[] = {
|
||||||
".. method:: normal()\n"
|
{NULL, NULL, 0, NULL}
|
||||||
"\n"
|
};
|
||||||
" Returns the normal to the Face it is running accross.\n"
|
|
||||||
"\n"
|
|
||||||
" :return: The normal to the Face it is running accross.\n"
|
|
||||||
" :rtype: :class:`mathutils.Vector`\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSmooth_normal( BPy_FEdgeSmooth *self ) {
|
/*----------------------mathutils callbacks ----------------------------*/
|
||||||
Vec3r v( self->fes->normal() );
|
|
||||||
return Vector_from_Vec3r( v );
|
static int FEdgeSmooth_mathutils_check(BaseMathObject *bmo)
|
||||||
|
{
|
||||||
|
if (!BPy_FEdgeSmooth_Check(bmo->cb_user))
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FEdgeSmooth_materialIndex___doc__[] =
|
static int FEdgeSmooth_mathutils_get(BaseMathObject *bmo, int subtype)
|
||||||
".. method:: materialIndex()\n"
|
{
|
||||||
"\n"
|
BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user;
|
||||||
" Returns the index of the material of the face it is running accross.\n"
|
Vec3r p(self->fes->normal());
|
||||||
"\n"
|
bmo->data[0] = p[0];
|
||||||
" :return: The index of the material of the face it is running accross.\n"
|
bmo->data[1] = p[1];
|
||||||
" :rtype: int\n";
|
bmo->data[2] = p[2];
|
||||||
|
return 0;
|
||||||
static PyObject * FEdgeSmooth_materialIndex( BPy_FEdgeSmooth *self ) {
|
|
||||||
return PyLong_FromLong( self->fes->frs_materialIndex() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FEdgeSmooth_material___doc__[] =
|
static int FEdgeSmooth_mathutils_set(BaseMathObject *bmo, int subtype)
|
||||||
".. method:: material()\n"
|
{
|
||||||
"\n"
|
BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user;
|
||||||
" Returns the material of the face it is running accross.\n"
|
Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
|
||||||
"\n"
|
self->fes->setNormal(p);
|
||||||
" :return: The material of the face it is running accross.\n"
|
return 0;
|
||||||
" :rtype: :class:`Material`\n";
|
}
|
||||||
|
|
||||||
static PyObject * FEdgeSmooth_material( BPy_FEdgeSmooth *self ) {
|
static int FEdgeSmooth_mathutils_get_index(BaseMathObject *bmo, int subtype, int index)
|
||||||
FrsMaterial m( self->fes->frs_material() );
|
{
|
||||||
|
BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user;
|
||||||
|
Vec3r p(self->fes->normal());
|
||||||
|
bmo->data[index] = p[index];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FEdgeSmooth_mathutils_set_index(BaseMathObject *bmo, int subtype, int index)
|
||||||
|
{
|
||||||
|
BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user;
|
||||||
|
Vec3r p(self->fes->normal());
|
||||||
|
p[index] = bmo->data[index];
|
||||||
|
self->fes->setNormal(p);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Mathutils_Callback FEdgeSmooth_mathutils_cb = {
|
||||||
|
FEdgeSmooth_mathutils_check,
|
||||||
|
FEdgeSmooth_mathutils_get,
|
||||||
|
FEdgeSmooth_mathutils_set,
|
||||||
|
FEdgeSmooth_mathutils_get_index,
|
||||||
|
FEdgeSmooth_mathutils_set_index
|
||||||
|
};
|
||||||
|
|
||||||
|
static unsigned char FEdgeSmooth_mathutils_cb_index = -1;
|
||||||
|
|
||||||
|
void FEdgeSmooth_mathutils_register_callback()
|
||||||
|
{
|
||||||
|
FEdgeSmooth_mathutils_cb_index = Mathutils_RegisterCallback(&FEdgeSmooth_mathutils_cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*----------------------FEdgeSmooth get/setters ----------------------------*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FEdgeSmooth_normal_doc,
|
||||||
|
"The normal of the face that this FEdge is running across.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`mathutils.Vector`");
|
||||||
|
|
||||||
|
static PyObject *FEdgeSmooth_normal_get(BPy_FEdgeSmooth *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return Vector_CreatePyObject_cb((PyObject *)self, 3, FEdgeSmooth_mathutils_cb_index, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FEdgeSmooth_normal_set(BPy_FEdgeSmooth *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
float v[3];
|
||||||
|
if (!float_array_from_PyObject(value, v, 3)) {
|
||||||
|
PyErr_SetString(PyExc_ValueError, "value must be a 3-dimensional vector");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
Vec3r p(v[0], v[1], v[2]);
|
||||||
|
self->fes->setNormal(p);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FEdgeSmooth_material_index_doc,
|
||||||
|
"The index of the material of the face that this FEdge is running across.\n"
|
||||||
|
"\n"
|
||||||
|
":type: int");
|
||||||
|
|
||||||
|
static PyObject *FEdgeSmooth_material_index_get(BPy_FEdgeSmooth *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
return PyLong_FromLong(self->fes->frs_materialIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FEdgeSmooth_material_index_set(BPy_FEdgeSmooth *self, PyObject *value, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
unsigned int i = PyLong_AsUnsignedLong(value);
|
||||||
|
if(PyErr_Occurred())
|
||||||
|
return -1;
|
||||||
|
self->fes->setFrsMaterialIndex(i);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(FEdgeSmooth_material_doc,
|
||||||
|
"The material of the face that this FEdge is running across.\n"
|
||||||
|
"\n"
|
||||||
|
":type: :class:`Material`");
|
||||||
|
|
||||||
|
static PyObject *FEdgeSmooth_material_get(BPy_FEdgeSmooth *self, void *UNUSED(closure))
|
||||||
|
{
|
||||||
|
// FIXME frs_material() returns a const reference.
|
||||||
|
FrsMaterial m(self->fes->frs_material());
|
||||||
return BPy_FrsMaterial_from_FrsMaterial(m);
|
return BPy_FrsMaterial_from_FrsMaterial(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FEdgeSmooth_faceMark___doc__[] =
|
PyDoc_STRVAR(FEdgeSmooth_face_mark_doc,
|
||||||
".. method:: faceMark()\n"
|
"The face mark of the face that this FEdge is running across.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Returns the face mark of the face it is running across.\n"
|
":type: bool");
|
||||||
"\n"
|
|
||||||
" :return: The face mark of the face it is running across.\n"
|
|
||||||
" :rtype: bool\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSmooth_faceMark( BPy_FEdgeSmooth *self ) {
|
static PyObject *FEdgeSmooth_face_mark_get(BPy_FEdgeSmooth *self, void *UNUSED(closure))
|
||||||
return PyBool_from_bool( self->fes->faceMark() );
|
{
|
||||||
|
return PyBool_from_bool(self->fes->faceMark());
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FEdgeSmooth_setNormal___doc__[] =
|
static int FEdgeSmooth_face_mark_set(BPy_FEdgeSmooth *self, PyObject *value, void *UNUSED(closure))
|
||||||
".. method:: setNormal(iNormal)\n"
|
{
|
||||||
"\n"
|
if(!PyBool_Check(value))
|
||||||
" Sets the normal to the Face it is running accross.\n"
|
return -1;
|
||||||
"\n"
|
self->fes->setFaceMark(bool_from_PyBool(value));
|
||||||
" :arg iNormal: A three-dimensional vector.\n"
|
return 0;
|
||||||
" :type iNormal: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSmooth_setNormal( BPy_FEdgeSmooth *self, PyObject *args ) {
|
|
||||||
PyObject *obj = 0;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O", &obj) ))
|
|
||||||
return NULL;
|
|
||||||
Vec3r *v = Vec3r_ptr_from_PyObject(obj);
|
|
||||||
if( !v ) {
|
|
||||||
PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
self->fes->setNormal( *v );
|
|
||||||
delete v;
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FEdgeSmooth_setMaterialIndex___doc__[] =
|
static PyGetSetDef BPy_FEdgeSmooth_getseters[] = {
|
||||||
".. method:: setMaterialIndex(i)\n"
|
{(char *)"normal", (getter)FEdgeSmooth_normal_get, (setter)FEdgeSmooth_normal_set, (char *)FEdgeSmooth_normal_doc, NULL},
|
||||||
"\n"
|
{(char *)"material_index", (getter)FEdgeSmooth_material_index_get, (setter)FEdgeSmooth_material_index_set, (char *)FEdgeSmooth_material_index_doc, NULL},
|
||||||
" Sets the index of the material of the face it is running accross.\n"
|
{(char *)"material", (getter)FEdgeSmooth_material_get, (setter)NULL, (char *)FEdgeSmooth_material_doc, NULL},
|
||||||
"\n"
|
{(char *)"face_mark", (getter)FEdgeSmooth_face_mark_get, (setter)FEdgeSmooth_face_mark_set, (char *)FEdgeSmooth_face_mark_doc, NULL},
|
||||||
" :arg i: The index of the material of the face it is running accross.\n"
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||||
" :type i: int\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSmooth_setMaterialIndex( BPy_FEdgeSmooth *self, PyObject *args ) {
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "I", &i) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->fes->setFrsMaterialIndex( i );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FEdgeSmooth_setFaceMark___doc__[] =
|
|
||||||
".. method:: setFaceMark(i)\n"
|
|
||||||
"\n"
|
|
||||||
" Sets the face mark of the face it is running across.\n"
|
|
||||||
"\n"
|
|
||||||
" :arg i: A face mark.\n"
|
|
||||||
" :type i: bool\n";
|
|
||||||
|
|
||||||
static PyObject * FEdgeSmooth_setFaceMark( BPy_FEdgeSmooth *self, PyObject *args ) {
|
|
||||||
PyObject *obj;
|
|
||||||
|
|
||||||
if(!( PyArg_ParseTuple(args, "O", &obj) ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self->fes->setFaceMark( bool_from_PyBool(obj) );
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*----------------------FEdgeSmooth instance definitions ----------------------------*/
|
|
||||||
static PyMethodDef BPy_FEdgeSmooth_methods[] = {
|
|
||||||
{"normal", ( PyCFunction ) FEdgeSmooth_normal, METH_NOARGS, FEdgeSmooth_normal___doc__},
|
|
||||||
{"materialIndex", ( PyCFunction ) FEdgeSmooth_materialIndex, METH_NOARGS, FEdgeSmooth_materialIndex___doc__},
|
|
||||||
{"material", ( PyCFunction ) FEdgeSmooth_material, METH_NOARGS, FEdgeSmooth_material___doc__},
|
|
||||||
{"faceMark", ( PyCFunction ) FEdgeSmooth_faceMark, METH_NOARGS, FEdgeSmooth_faceMark___doc__},
|
|
||||||
{"setNormal", ( PyCFunction ) FEdgeSmooth_setNormal, METH_VARARGS, FEdgeSmooth_setNormal___doc__},
|
|
||||||
{"setMaterialIndex", ( PyCFunction ) FEdgeSmooth_setMaterialIndex, METH_VARARGS, FEdgeSmooth_setMaterialIndex___doc__},
|
|
||||||
{"setFaceMark", ( PyCFunction ) FEdgeSmooth_setFaceMark, METH_VARARGS, FEdgeSmooth_setFaceMark___doc__},
|
|
||||||
{NULL, NULL, 0, NULL}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-----------------------BPy_FEdgeSmooth type definition ------------------------------*/
|
/*-----------------------BPy_FEdgeSmooth type definition ------------------------------*/
|
||||||
@@ -213,7 +233,7 @@ PyTypeObject FEdgeSmooth_Type = {
|
|||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
FEdgeSmooth___doc__, /* tp_doc */
|
FEdgeSmooth_doc, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
@@ -222,13 +242,13 @@ PyTypeObject FEdgeSmooth_Type = {
|
|||||||
0, /* tp_iternext */
|
0, /* tp_iternext */
|
||||||
BPy_FEdgeSmooth_methods, /* tp_methods */
|
BPy_FEdgeSmooth_methods, /* tp_methods */
|
||||||
0, /* tp_members */
|
0, /* tp_members */
|
||||||
0, /* tp_getset */
|
BPy_FEdgeSmooth_getseters, /* tp_getset */
|
||||||
&FEdge_Type, /* tp_base */
|
&FEdge_Type, /* tp_base */
|
||||||
0, /* tp_dict */
|
0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
(initproc)FEdgeSmooth___init__, /* tp_init */
|
(initproc)FEdgeSmooth_init, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
0, /* tp_new */
|
0, /* tp_new */
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ typedef struct {
|
|||||||
FEdgeSmooth *fes;
|
FEdgeSmooth *fes;
|
||||||
} BPy_FEdgeSmooth;
|
} BPy_FEdgeSmooth;
|
||||||
|
|
||||||
|
/*---------------------------Python BPy_FEdgeSmooth visible prototypes-----------*/
|
||||||
|
|
||||||
|
void FEdgeSmooth_mathutils_register_callback();
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
Reference in New Issue
Block a user