Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Amanda Ghassaei
OrigamiSimulator
Commits
e628e2f6
Commit
e628e2f6
authored
May 31, 2017
by
amandaghassaei
Browse files
catching errors
parent
7ad32ef2
Changes
1
Hide whitespace changes
Inline
Side-by-side
index.html
View file @
e628e2f6
...
...
@@ -392,8 +392,12 @@
vec3
node3
=
texture2D
(
u_originalPosition
,
node3Index
).
xyz
+
texture2D
(
u_lastPosition
,
node3Index
).
xyz
;
vec3
node4
=
texture2D
(
u_originalPosition
,
node4Index
).
xyz
+
texture2D
(
u_lastPosition
,
node4Index
).
xyz
;
float
tol
=
0.001
;
vec3
creaseVector
=
node4
-
node3
;
float
creaseLength
=
length
(
creaseVector
);
if
(
abs
(
creaseLength
)
<
tol
)
creaseLength
=
tol
;
creaseVector
/=
creaseLength
;
vec3
vector1
=
node1
-
node3
;
...
...
@@ -401,8 +405,12 @@
float
proj1Length
=
dot
(
creaseVector
,
vector1
);
float
proj2Length
=
dot
(
creaseVector
,
vector2
);
float
dist1
=
sqrt
(
vector1
.
x
*
vector1
.
x
+
vector1
.
y
*
vector1
.
y
+
vector1
.
z
*
vector1
.
z
-
proj1Length
*
proj1Length
);
float
dist2
=
sqrt
(
vector2
.
x
*
vector2
.
x
+
vector2
.
y
*
vector2
.
y
+
vector2
.
z
*
vector2
.
z
-
proj2Length
*
proj2Length
);
float
dist1
=
sqrt
(
abs
(
vector1
.
x
*
vector1
.
x
+
vector1
.
y
*
vector1
.
y
+
vector1
.
z
*
vector1
.
z
-
proj1Length
*
proj1Length
));
float
dist2
=
sqrt
(
abs
(
vector2
.
x
*
vector2
.
x
+
vector2
.
y
*
vector2
.
y
+
vector2
.
z
*
vector2
.
z
-
proj2Length
*
proj2Length
));
if
(
abs
(
dist1
)
<
tol
)
dist1
=
tol
;
if
(
abs
(
dist2
)
<
tol
)
dist2
=
tol
;
gl_FragColor
=
vec4
(
dist1
,
dist2
,
proj1Length
/
creaseLength
,
proj2Length
/
creaseLength
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment