Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mods
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
mods
Commits
4707b91d
Commit
4707b91d
authored
7 years ago
by
Neil Gershenfeld
Browse files
Options
Downloads
Patches
Plain Diff
add clearance
parent
9fc0d4a3
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
files.html
+2
-0
2 additions, 0 deletions
files.html
modules/frep/operators/clearance
+138
-0
138 additions, 0 deletions
modules/frep/operators/clearance
modules/index.js
+1
-0
1 addition, 0 deletions
modules/index.js
with
141 additions
and
0 deletions
files.html
+
2
−
0
View file @
4707b91d
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
<a
href=
'./js/files.js'
>
files.js
</a><br>
<a
href=
'./js/files.js'
>
files.js
</a><br>
<a
href=
'./js/mods.js'
>
mods.js
</a><br>
<a
href=
'./js/mods.js'
>
mods.js
</a><br>
<a
href=
'./js/modules.js'
>
modules.js
</a><br>
<a
href=
'./js/modules.js'
>
modules.js
</a><br>
<i>
node_modules
</i><br>
<a
href=
'./js/printserver.js'
>
printserver.js
</a><br>
<a
href=
'./js/printserver.js'
>
printserver.js
</a><br>
<a
href=
'./js/programs.js'
>
programs.js
</a><br>
<a
href=
'./js/programs.js'
>
programs.js
</a><br>
<a
href=
'./js/serialserver.js'
>
serialserver.js
</a><br>
<a
href=
'./js/serialserver.js'
>
serialserver.js
</a><br>
...
@@ -57,6 +58,7 @@
...
@@ -57,6 +58,7 @@
<i>
operators
</i><br>
<i>
operators
</i><br>
<a
href=
'./modules/frep/operators/add'
>
add
</a><br>
<a
href=
'./modules/frep/operators/add'
>
add
</a><br>
<a
href=
'./modules/frep/operators/blend'
>
blend
</a><br>
<a
href=
'./modules/frep/operators/blend'
>
blend
</a><br>
<a
href=
'./modules/frep/operators/clearance'
>
clearance
</a><br>
<a
href=
'./modules/frep/operators/intersect'
>
intersect
</a><br>
<a
href=
'./modules/frep/operators/intersect'
>
intersect
</a><br>
<a
href=
'./modules/frep/operators/morph'
>
morph
</a><br>
<a
href=
'./modules/frep/operators/morph'
>
morph
</a><br>
<a
href=
'./modules/frep/operators/subtract'
>
subtract
</a><br>
<a
href=
'./modules/frep/operators/subtract'
>
subtract
</a><br>
...
...
This diff is collapsed.
Click to expand it.
modules/frep/operators/clearance
0 → 100755
+
138
−
0
View file @
4707b91d
//
// frep clearance
//
// Neil Gershenfeld
// (c) Massachusetts Institute of Technology 2018
//
// This work may be reproduced, modified, distributed, performed, and
// displayed for any purpose, but must acknowledge the mods
// project. Copyright is retained and must be preserved. The work is
// provided as is; no warranty is provided, and users accept all
// liability.
//
// closure
//
(function(){
//
// module globals
//
var mod = {}
//
// name
//
var name = 'frep clearance'
//
// initialization
//
var init = function() {
mod.shape0 = null
mod.shape1 = null
mod.offset.value = 1
mod.fn0.value = ''
mod.fn1.value = ''
}
//
// inputs
//
var inputs = {
shape0:{type:'',label:'shape 0',
event:function(evt){
mod.shape0 = evt.detail
mod.fn0.value = evt.detail.function
outputs.shape.event()
}},
shape1:{type:'',label:'shape 1',
event:function(evt){
mod.shape1 = evt.detail
mod.fn1.value = evt.detail.function
outputs.shape.event()
}},
clear:{type:'',
event:function(evt){
mod.shape0 = null
mod.shape1 = null
mod.fn0.value = ''
mod.fn1.value = ''
}}}
//
// outputs
//
var outputs = {
shape:{type:'',
event:function(){
if ((mod.shape0 != null) && (mod.shape1 != null)) {
var offset = parseFloat(mod.offset.value)
var fn = `Math.min(${mod.shape0.function},-(${offset}+${mod.shape1.function}))`
var fn = `Math.max(${fn},${mod.shape1.function})`
var variables = mod.shape0.variables
var type = mod.shape0.type
var limits = []
for (var v = 0; v < mod.shape0.limits.length; ++v) {
limits[v] = []
if (mod.shape0.limits[v][0] < mod.shape1.limits[v][0])
limits[v][0] = mod.shape0.limits[v][0]
else
limits[v][0] = mod.shape1.limits[v][0]
if (mod.shape0.limits[v][1] > mod.shape1.limits[v][1])
limits[v][1] = mod.shape0.limits[v][1]
else
limits[v][1] = mod.shape1.limits[v][1]
}
var shape = {function:fn,variables:variables,limits:limits,type:type}
mods.output(mod,'shape',shape)}
}
}}
//
// interface
//
var interface = function(div){
mod.div = div
//
// offset
//
div.appendChild(document.createTextNode('offset: '))
div.appendChild(document.createElement('br'))
var input = document.createElement('input')
input.type = 'text'
input.size = 6
div.appendChild(input)
mod.offset = input
div.appendChild(document.createElement('br'))
//
// function 0
//
div.appendChild(document.createTextNode('function 0: '))
div.appendChild(document.createElement('br'))
var input = document.createElement('input')
input.type = 'text'
input.size = 10
div.appendChild(input)
mod.fn0 = input
div.appendChild(document.createElement('br'))
//
// function 1
//
div.appendChild(document.createTextNode('function 1: '))
div.appendChild(document.createElement('br'))
var input = document.createElement('input')
input.type = 'text'
input.size = 10
div.appendChild(input)
mod.fn1 = input
div.appendChild(document.createElement('br'))
}
//
// local functions
//
;
//
// return values
//
return ({
name:name,
init:init,
inputs:inputs,
outputs:outputs,
interface:interface
})
}())
This diff is collapsed.
Click to expand it.
modules/index.js
+
1
−
0
View file @
4707b91d
...
@@ -28,6 +28,7 @@ module_label('frep')
...
@@ -28,6 +28,7 @@ module_label('frep')
module_label
(
'
operators
'
)
module_label
(
'
operators
'
)
module_menu
(
'
add
'
,
'
modules/frep/operators/add
'
)
module_menu
(
'
add
'
,
'
modules/frep/operators/add
'
)
module_menu
(
'
blend
'
,
'
modules/frep/operators/blend
'
)
module_menu
(
'
blend
'
,
'
modules/frep/operators/blend
'
)
module_menu
(
'
clearance
'
,
'
modules/frep/operators/clearance
'
)
module_menu
(
'
intersect
'
,
'
modules/frep/operators/intersect
'
)
module_menu
(
'
intersect
'
,
'
modules/frep/operators/intersect
'
)
module_menu
(
'
morph
'
,
'
modules/frep/operators/morph
'
)
module_menu
(
'
morph
'
,
'
modules/frep/operators/morph
'
)
module_menu
(
'
subtract
'
,
'
modules/frep/operators/subtract
'
)
module_menu
(
'
subtract
'
,
'
modules/frep/operators/subtract
'
)
...
...
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