Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
computergrafik-03
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Temple
computergrafik-03
Commits
ea2840c5
Unverified
Commit
ea2840c5
authored
3 years ago
by
Jamie Temple
Browse files
Options
Downloads
Patches
Plain Diff
change: more visuals for quaternions
parent
9441a095
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/uitls/RotationObject.ts
+37
-27
37 additions, 27 deletions
src/uitls/RotationObject.ts
with
37 additions
and
27 deletions
src/uitls/RotationObject.ts
+
37
−
27
View file @
ea2840c5
...
@@ -13,7 +13,7 @@ export class RotationObject implements Updatable, Modifiable {
...
@@ -13,7 +13,7 @@ export class RotationObject implements Updatable, Modifiable {
public
t
:
number
=
0
;
public
t
:
number
=
0
;
private
_qworking
:
Quaternion
=
new
Quaternion
();;
private
_qworking
:
Quaternion
=
new
Quaternion
();;
private
_orientation
:
Group
=
new
Group
();
//
private _orientation: Group = new Group();
private
_coordinate
:
Group
=
new
Group
();
private
_coordinate
:
Group
=
new
Group
();
private
_rotationAxis
:
Group
=
new
Group
();
private
_rotationAxis
:
Group
=
new
Group
();
private
_mesh
?:
Mesh
;
private
_mesh
?:
Mesh
;
...
@@ -159,43 +159,53 @@ export class RotationObject implements Updatable, Modifiable {
...
@@ -159,43 +159,53 @@ export class RotationObject implements Updatable, Modifiable {
}
}
updateRotationAxis
():
void
{
updateRotationAxis
():
void
{
const
line
=
this
.
_rotationAxis
.
getObjectByName
(
"
rotationAxisLine
"
)
as
Line
;
const
point
=
this
.
_rotationAxis
.
getObjectByName
(
"
rotationAxisPoint
"
)
as
Mesh
;
if
(
line
.
geometry
)
const
suffix
:
string
[]
=
[
"
A
"
,
"
B
"
,
"
C
"
];
line
.
geometry
.
dispose
();
const
ref
:
Quaternion
[]
=
[
this
.
qa
,
this
.
qb
,
this
.
_qworking
];
for
(
let
i
=
0
;
i
<
suffix
.
length
;
i
++
)
{
const
line
=
this
.
_rotationAxis
.
getObjectByName
(
"
rotationAxisLine
"
+
suffix
[
i
])
as
Line
;
const
point
=
this
.
_rotationAxis
.
getObjectByName
(
"
rotationAxisPoint
"
+
suffix
[
i
])
as
Mesh
;
if
(
line
.
geometry
)
line
.
geometry
.
dispose
();
const
dir
=
new
Vector3
(
const
dir
=
new
Vector3
(
this
.
_qworking
.
x
,
ref
[
i
]
.
x
,
this
.
_qworking
.
y
,
ref
[
i
]
.
y
,
this
.
_qworking
.
z
ref
[
i
]
.
z
)
;
)
const
origin
=
new
Vector3
(
0
,
0
,
0
);
const
origin
=
new
Vector3
(
0
,
0
,
0
);
line
.
geometry
=
new
BufferGeometry
().
setFromPoints
([
line
.
geometry
=
new
BufferGeometry
().
setFromPoints
([
origin
,
dir
.
normalize
().
multiplyScalar
(
2
)]);
origin
,
dir
.
normalize
()]);
point
.
position
.
copy
(
dir
);
point
.
position
.
copy
(
dir
);
}
}
}
createRotationAxis
():
void
{
createRotationAxis
():
void
{
const
dir
=
new
Line
(
const
colors
:
Color
[]
=
[
new
Color
(
0xff8844
),
new
Color
(
0x44ff88
),
new
Color
(
0x884488
)
]
const
suffix
:
string
[]
=
[
"
A
"
,
"
B
"
,
"
C
"
];
for
(
let
i
=
0
;
i
<
suffix
.
length
;
i
++
)
{
const
line
=
new
Line
(
undefined
,
undefined
,
new
LineBasicMaterial
({
color
:
0xff8844
})
new
LineBasicMaterial
({
color
:
colors
[
i
].
getHex
()
})
);
);
dir
.
name
=
"
rotationAxisLine
"
;
line
.
name
=
"
rotationAxisLine
"
+
suffix
[
i
];
this
.
_rotationAxis
.
add
(
line
);
const
point
=
new
Mesh
(
const
point
=
new
Mesh
(
new
SphereBufferGeometry
(.
0
2
5
,
32
,
32
),
new
SphereBufferGeometry
(.
05
,
32
,
32
),
new
MeshBasicMaterial
({
color
:
0xff8844
})
new
MeshBasicMaterial
({
color
:
colors
[
i
].
getHex
()
})
);
);
point
.
name
=
"
rotationAxisPoint
"
;
point
.
name
=
"
rotationAxisPoint
"
+
suffix
[
i
];
this
.
_rotationAxis
.
add
(
dir
);
this
.
_rotationAxis
.
add
(
point
);
this
.
_rotationAxis
.
add
(
point
);
}
this
.
updateRotationAxis
();
this
.
updateRotationAxis
();
}
}
setMesh
(
mesh
:
Mesh
):
void
{
setMesh
(
mesh
:
Mesh
):
void
{
...
...
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