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
401a9af9
Commit
401a9af9
authored
5 years ago
by
Neil Gershenfeld
Browse files
Options
Downloads
Patches
Plain Diff
wip
parent
5621e00a
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
modules/processes/mill/raster/3D
+17
-13
17 additions, 13 deletions
modules/processes/mill/raster/3D
with
17 additions
and
13 deletions
modules/processes/mill/raster/3D
+
17
−
13
View file @
401a9af9
...
@@ -300,10 +300,11 @@ function calculate_path_worker() {
...
@@ -300,10 +300,11 @@ function calculate_path_worker() {
//
//
var toolsize = Math.floor(diameter*w/(mmunits*(xmax-xmin)))
var toolsize = Math.floor(diameter*w/(mmunits*(xmax-xmin)))
var tooloffset = new Float32Array(toolsize*toolsize)
var tooloffset = new Float32Array(toolsize*toolsize)
var toolmiddle = Math.floor(toolsize/2)
for (var x = 0; x < toolsize; ++x)
for (var x = 0; x < toolsize; ++x)
for (var y = 0; y < toolsize; ++y) {
for (var y = 0; y < toolsize; ++y) {
var r = Math.sqrt((x-tool
size/2
)*(x-tool
size/2
)+(y-tool
size/2
)*(y-tool
size/2
))
var r = Math.sqrt((x-tool
middle
)*(x-tool
middle
)+(y-tool
middle
)*(y-tool
middle
))
if (r <= tool
size/2
)
if (r <= tool
middle
)
tooloffset[y*toolsize+x] = 0
tooloffset[y*toolsize+x] = 0
else
else
tooloffset[y*toolsize+x] = Number.MAX_VALUE
tooloffset[y*toolsize+x] = Number.MAX_VALUE
...
@@ -311,15 +312,15 @@ function calculate_path_worker() {
...
@@ -311,15 +312,15 @@ function calculate_path_worker() {
//
//
// loop over lines
// loop over lines
//
//
xstart = 0
var
xstart = 0
ystart = h-1
var
ystart = h-1
zstart =
Math.floor(
(map[ystart*w+xstart]-zmax)*w/(xmax-xmin)
)
var
zstart = (map[ystart*w+xstart]-zmax)*w/(xmax-xmin)
path[0].push([xstart,h-1-ystart,zstart])
path[0].push([xstart,h-1-ystart,zstart])
xcur = 1
var
xcur = 1
ycur = h-1
var
ycur = h-1
zcur =
Math.floor(
(map[ycur*w+xcur]-zmax)*w/(xmax-xmin)
)
var
zcur = (map[ycur*w+xcur]-zmax)*w/(xmax-xmin)
dx = 1
var
dx = 1
dy = 0
var
dy = 0
while (1) {
while (1) {
//
//
// move to next point
// move to next point
...
@@ -334,9 +335,12 @@ function calculate_path_worker() {
...
@@ -334,9 +335,12 @@ function calculate_path_worker() {
//
//
// find offset at next point
// find offset at next point
//
//
for (var x = 0; x < toolsize; ++x)
for (var xoffset = 0; xoffset < toolsize; ++xoffset)
for (var y = 0; y < toolsize; ++y) {
for (var yoffset = 0; yoffset < toolsize; ++yoffset) {
znext = Math.floor((map[ynext*w+xnext]-zmax)*w/(xmax-xmin))
var x = xcur+(xoffset-toolmiddle)
var y = ycur+(yoffset-toolmiddle)
var offset = tooloffset[yoffset*toolsize+xoffset]
znext = (map[ynext*w+xnext]-zmax)*w/(xmax-xmin)
}
}
//
//
// vectorize
// vectorize
...
...
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