Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
webgl25
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
RIFI Zaynab
webgl25
Commits
84d2e639
Commit
84d2e639
authored
1 month ago
by
RIFI Zaynab
Browse files
Options
Downloads
Patches
Plain Diff
Delete lib
parent
3137885f
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
RIFI/lib/Coordinates.js
+0
-152
0 additions, 152 deletions
RIFI/lib/Coordinates.js
with
0 additions
and
152 deletions
RIFI/lib/Coordinates.js
deleted
100644 → 0
+
0
−
152
View file @
3137885f
"
use strict
"
;
// good practice - see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode
/*global THREE, scene*/
import
*
as
THREE
from
'
three
'
;
export
let
Coordinates
=
{
drawGrid
:
function
(
params
)
{
params
=
params
||
{};
var
size
=
params
.
size
!==
undefined
?
params
.
size
:
100
;
var
scale
=
params
.
scale
!==
undefined
?
params
.
scale
:
0.1
;
var
orientation
=
params
.
orientation
!==
undefined
?
params
.
orientation
:
"
x
"
;
var
grid
=
new
THREE
.
Mesh
(
new
THREE
.
PlaneGeometry
(
size
,
size
,
size
*
scale
,
size
*
scale
),
new
THREE
.
MeshBasicMaterial
({
color
:
0x555555
,
wireframe
:
true
})
);
// Yes, these are poorly labeled! It would be a mess to fix.
// What's really going on here:
// "x" means "rotate 90 degrees around x", etc.
// So "x" really means "show a grid with a normal of Y"
// "y" means "show a grid with a normal of X"
// "z" means (logically enough) "show a grid with a normal of Z"
if
(
orientation
===
"
x
"
)
{
grid
.
rotation
.
x
=
-
Math
.
PI
/
2
;
}
else
if
(
orientation
===
"
y
"
)
{
grid
.
rotation
.
y
=
-
Math
.
PI
/
2
;
}
else
if
(
orientation
===
"
z
"
)
{
grid
.
rotation
.
z
=
-
Math
.
PI
/
2
;
}
window
.
scene
.
add
(
grid
);
},
drawGround
:
function
(
params
)
{
params
=
params
||
{};
var
size
=
params
.
size
!==
undefined
?
params
.
size
:
100
;
var
color
=
params
.
color
!==
undefined
?
params
.
color
:
0xFFFFFF
;
var
ground
=
new
THREE
.
Mesh
(
new
THREE
.
PlaneGeometry
(
size
,
size
),
// When we use a ground plane we use directional lights, so illuminating
// just the corners is sufficient.
// Use MeshPhongMaterial if you want to capture per-pixel lighting:
// new THREE.MeshPhongMaterial({ color: color, specular: 0x000000,
new
THREE
.
MeshLambertMaterial
({
color
:
color
,
// polygonOffset moves the plane back from the eye a bit, so that the lines on top of
// the grid do not have z-fighting with the grid:
// Factor == 1 moves it back relative to the slope (more on-edge means move back farther)
// Units == 4 is a fixed amount to move back, and 4 is usually a good value
polygonOffset
:
true
,
polygonOffsetFactor
:
1.0
,
polygonOffsetUnits
:
4.0
}));
ground
.
rotation
.
x
=
-
Math
.
PI
/
2
;
window
.
scene
.
add
(
ground
);
},
drawAxes
:
function
(
params
)
{
// x = red, y = green, z = blue (RGB = xyz)
params
=
params
||
{};
var
axisRadius
=
params
.
axisRadius
!==
undefined
?
params
.
axisRadius
:
0.04
;
var
axisLength
=
params
.
axisLength
!==
undefined
?
params
.
axisLength
:
11
;
var
axisTess
=
params
.
axisTess
!==
undefined
?
params
.
axisTess
:
48
;
var
axisOrientation
=
params
.
axisOrientation
!==
undefined
?
params
.
axisOrientation
:
"
x
"
;
var
axisMaterial
=
new
THREE
.
MeshLambertMaterial
({
color
:
0x000000
,
side
:
THREE
.
DoubleSide
});
var
axis
=
new
THREE
.
Mesh
(
new
THREE
.
CylinderGeometry
(
axisRadius
,
axisRadius
,
axisLength
,
axisTess
,
1
,
true
),
axisMaterial
);
if
(
axisOrientation
===
"
x
"
)
{
axis
.
rotation
.
z
=
-
Math
.
PI
/
2
;
axis
.
position
.
x
=
axisLength
/
2
-
1
;
}
else
if
(
axisOrientation
===
"
y
"
)
{
axis
.
position
.
y
=
axisLength
/
2
-
1
;
}
window
.
scene
.
add
(
axis
);
var
arrow
=
new
THREE
.
Mesh
(
new
THREE
.
CylinderGeometry
(
0
,
4
*
axisRadius
,
8
*
axisRadius
,
axisTess
,
1
,
true
),
axisMaterial
);
if
(
axisOrientation
===
"
x
"
)
{
arrow
.
rotation
.
z
=
-
Math
.
PI
/
2
;
arrow
.
position
.
x
=
axisLength
-
1
+
axisRadius
*
4
/
2
;
}
else
if
(
axisOrientation
===
"
y
"
)
{
arrow
.
position
.
y
=
axisLength
-
1
+
axisRadius
*
4
/
2
;
}
window
.
scene
.
add
(
arrow
);
},
drawAllAxes
:
function
(
params
)
{
params
=
params
||
{};
var
axisRadius
=
params
.
axisRadius
!==
undefined
?
params
.
axisRadius
:
0.04
;
var
axisLength
=
params
.
axisLength
!==
undefined
?
params
.
axisLength
:
11
;
var
axisTess
=
params
.
axisTess
!==
undefined
?
params
.
axisTess
:
48
;
var
axisXMaterial
=
new
THREE
.
MeshLambertMaterial
({
color
:
0xFF0000
});
var
axisYMaterial
=
new
THREE
.
MeshLambertMaterial
({
color
:
0x00FF00
});
var
axisZMaterial
=
new
THREE
.
MeshLambertMaterial
({
color
:
0x0000FF
});
axisXMaterial
.
side
=
THREE
.
DoubleSide
;
axisYMaterial
.
side
=
THREE
.
DoubleSide
;
axisZMaterial
.
side
=
THREE
.
DoubleSide
;
var
axisX
=
new
THREE
.
Mesh
(
new
THREE
.
CylinderGeometry
(
axisRadius
,
axisRadius
,
axisLength
,
axisTess
,
1
,
true
),
axisXMaterial
);
var
axisY
=
new
THREE
.
Mesh
(
new
THREE
.
CylinderGeometry
(
axisRadius
,
axisRadius
,
axisLength
,
axisTess
,
1
,
true
),
axisYMaterial
);
var
axisZ
=
new
THREE
.
Mesh
(
new
THREE
.
CylinderGeometry
(
axisRadius
,
axisRadius
,
axisLength
,
axisTess
,
1
,
true
),
axisZMaterial
);
axisX
.
rotation
.
z
=
-
Math
.
PI
/
2
;
axisX
.
position
.
x
=
axisLength
/
2
-
1
;
axisY
.
position
.
y
=
axisLength
/
2
-
1
;
axisZ
.
rotation
.
y
=
-
Math
.
PI
/
2
;
axisZ
.
rotation
.
z
=
-
Math
.
PI
/
2
;
axisZ
.
position
.
z
=
axisLength
/
2
-
1
;
window
.
scene
.
add
(
axisX
);
window
.
scene
.
add
(
axisY
);
window
.
scene
.
add
(
axisZ
);
var
arrowX
=
new
THREE
.
Mesh
(
new
THREE
.
CylinderGeometry
(
0
,
4
*
axisRadius
,
4
*
axisRadius
,
axisTess
,
1
,
true
),
axisXMaterial
);
var
arrowY
=
new
THREE
.
Mesh
(
new
THREE
.
CylinderGeometry
(
0
,
4
*
axisRadius
,
4
*
axisRadius
,
axisTess
,
1
,
true
),
axisYMaterial
);
var
arrowZ
=
new
THREE
.
Mesh
(
new
THREE
.
CylinderGeometry
(
0
,
4
*
axisRadius
,
4
*
axisRadius
,
axisTess
,
1
,
true
),
axisZMaterial
);
arrowX
.
rotation
.
z
=
-
Math
.
PI
/
2
;
arrowX
.
position
.
x
=
axisLength
-
1
+
axisRadius
*
4
/
2
;
arrowY
.
position
.
y
=
axisLength
-
1
+
axisRadius
*
4
/
2
;
arrowZ
.
rotation
.
z
=
-
Math
.
PI
/
2
;
arrowZ
.
rotation
.
y
=
-
Math
.
PI
/
2
;
arrowZ
.
position
.
z
=
axisLength
-
1
+
axisRadius
*
4
/
2
;
window
.
scene
.
add
(
arrowX
);
window
.
scene
.
add
(
arrowY
);
window
.
scene
.
add
(
arrowZ
);
}
};
\ No newline at end of file
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