Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons
Commits
1ab18e74
Commit
1ab18e74
authored
13 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
use slightly improved py syntax
parent
f453fc9b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mocap/mocap_tools.py
+19
-17
19 additions, 17 deletions
mocap/mocap_tools.py
with
19 additions
and
17 deletions
mocap/mocap_tools.py
+
19
−
17
View file @
1ab18e74
...
...
@@ -37,14 +37,16 @@ class NdVector:
return
len
(
self
.
vec
)
def
__mul__
(
self
,
otherMember
):
if
(
isinstance
(
otherMember
,
int
)
or
isinstance
(
otherMember
,
float
)):
return
NdVector
([
otherMember
*
x
for
x
in
self
.
vec
])
else
:
# assume anything with list access is a vector
if
isinstance
(
otherMember
,
NdVector
):
a
=
self
.
vec
b
=
otherMember
.
vec
n
=
len
(
self
)
return
sum
([
a
[
i
]
*
b
[
i
]
for
i
in
range
(
n
)])
else
:
# int/float
return
NdVector
([
otherMember
*
x
for
x
in
self
.
vec
])
def
__sub__
(
self
,
otherVec
):
a
=
self
.
vec
...
...
@@ -61,10 +63,12 @@ class NdVector:
def
__div__
(
self
,
scalar
):
return
NdVector
([
x
/
scalar
for
x
in
self
.
vec
])
def
vecLength
(
self
):
@property
def
length
(
self
):
return
sqrt
(
self
*
self
)
def
vecLengthSq
(
self
):
@property
def
lengthSq
(
self
):
return
(
self
*
self
)
def
normalize
(
self
):
...
...
@@ -77,20 +81,17 @@ class NdVector:
def
__getitem__
(
self
,
i
):
return
self
.
vec
[
i
]
@property
def
x
(
self
):
return
self
.
vec
[
0
]
@property
def
y
(
self
):
return
self
.
vec
[
1
]
def
resize_2d
(
self
):
return
Vector
((
self
.
x
,
self
.
y
))
length
=
property
(
vecLength
)
lengthSq
=
property
(
vecLengthSq
)
x
=
property
(
x
)
y
=
property
(
y
)
#Sampled Data Point class for Simplify Curves
class
dataPoint
:
...
...
@@ -266,12 +267,13 @@ def simplifyCurves(curveGroup, error, reparaError, maxIterations, group_mode):
# get binomial coefficient lookup table, this function/table is only called with args
# (3,0),(3,1),(3,2),(3,3),(2,0),(2,1),(2,2)!
binomDict
=
{(
3
,
0
):
1
,
(
3
,
1
):
3
,
(
3
,
2
):
3
,
(
3
,
3
):
1
,
(
2
,
0
):
1
,
(
2
,
1
):
2
,
(
2
,
2
):
1
}
(
3
,
1
):
3
,
(
3
,
2
):
3
,
(
3
,
3
):
1
,
(
2
,
0
):
1
,
(
2
,
1
):
2
,
(
2
,
2
):
1
,
}
#value at pt t of a single bernstein Polynomial
def
bernsteinPoly
(
n
,
i
,
t
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment