Platform
Resources
Pricing
Sign in
Get started
Felipe Ferrari
Sailing in data ocean.
Workspace
Fork
Published
From Concept to Simulation
By
Felipe Ferrari
Edited
Mar 6, 2022
Importers
1 star
1
From Concept to Simulation
A vessel.js tutorial
Chapter 1 - From Plane Lines to 3D Hull
Chapter 2 - From GA to Blocks
Section 2.2 - Compartments
Section 2.3 - Tanks
Section 2.4 - Equipments and STL elements
Section 2.5 - Importing External Elements
Section 2.6 - Creating a GLTF realistic model
Chapter 3 - Principles of System Engineering Applied to Gunnerus
Section 3.1 - GUI controller interface - Dropdown menu
Section 3.2 - GUI controller interface - Check Box List
Chapter 4 - Simulations and Analysis Principles for Vessel.js
Section 4.1 - Coordinate Reference System
Section 4.2 Advance Resistance Analysis - Pt.1: Propeller Model
Section 4.2 Advance Resistance Analysis - Pt.2: Resistance Model
Section 4.3 - A Brief Explanation of Maneuvering Mathematical Model
Insert cell
Insert cell
gui
=
new
dat
.
GUI
(
)
Insert cell
Insert cell
gui
.
domElement
.
id
=
'gui'
Insert cell
styles
=
html
`
<style>
#gui {
position: absolute;
top: 848px;
right: 0px
}
</style>
`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
ship
=
new
Vessel
.
Ship
(
Gunnerus
)
;
Insert cell
ship3D
=
new
Ship3D
(
ship
,
{
shipState
:
ship
.
designState
.
clone
(
)
,
stlPath
:
"https://shiplab.github.io/vesseljs/examples/3D_models/STL/Gunnerus/"
,
upperColor
:
0x33aa33
,
lowerColor
:
0xaa3333
,
hullOpacity
:
0.5
,
deckOpacity
:
0.5
,
objectOpacity
:
0.5
}
)
Insert cell
ship3D
.
name
=
"Ship3D"
Insert cell
Insert cell
Insert cell
Insert cell
mutable
ModelGLTF
=
{
}
Insert cell
scene
.
remove
(
scene
.
getObjectByName
(
"ModelGLTF"
)
)
Insert cell
Insert cell
scale
=
gui
.
addFolder
(
"Visualization parameters"
)
Insert cell
Insert cell
modelStyle
=
{
const
modelStructure
=
{
model
:
"ModelGLTF"
}
return
modelStructure
}
Insert cell
Insert cell
scale
.
add
(
modelStyle
,
"model"
,
{
Model
:
"ModelGLTF"
,
Blocks
:
"Ship3D"
,
}
)
.
onChange
(
newValue
=>
{
switchElement
(
newValue
)
}
)
.
name
(
"View"
)
Insert cell
scale
.
open
(
)
Insert cell
function
switchElement
(
stringModel
)
{
scene
.
children
.
forEach
(
element
=>
{
var
otherName
=
{
ModelGLTF
:
"Ship3D"
,
Ship3D
:
"ModelGLTF"
}
;
if
(
element
.
name
==
otherName
[
stringModel
]
)
{
scene
.
remove
(
element
)
;
}
}
)
;
// Switch function
switch
(
stringModel
)
{
case
"ModelGLTF"
:
scene
.
add
(
ModelGLTF
)
;
break
;
case
"Ship3D"
:
scene
.
add
(
ship3D
)
;
break
;
default
:
break
;
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
gui
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
styles
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Gunnerus
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
ship
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
ship3D
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
loaderGLTF
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
ModelGLTF
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
scale
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
modelStyle
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
switchElement
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Snippets
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
loaderPecentage
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
scene
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Ship3D
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
dat
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
THREE
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Vessel
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
d3
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML