mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 16:29:40 +00:00
Fixed VNF attachment normal vector.
This commit is contained in:
parent
da2a0bbd7b
commit
7daa16f238
2 changed files with 16 additions and 3 deletions
|
@ -473,7 +473,7 @@ function find_anchor(anchor, geom) =
|
|||
pt = polygon_line_intersection(poly, [cp,cp+anchor], bounded=[true,false], eps=eps)
|
||||
) if (!is_undef(pt)) let(
|
||||
plane = plane_from_polygon(poly),
|
||||
n = plane_normal(plane)
|
||||
n = unit(plane_normal(plane))
|
||||
)
|
||||
[norm(pt-cp), n, pt]
|
||||
]
|
||||
|
@ -483,7 +483,20 @@ function find_anchor(anchor, geom) =
|
|||
furthest = max_index(subindex(hits,0)),
|
||||
dist = hits[furthest][0],
|
||||
pos = hits[furthest][2],
|
||||
n = unit(sum([for (hit = hits) if (approx(hit[0],dist,eps=eps)) hit[1]]))
|
||||
hitnorms = [for (hit = hits) if (approx(hit[0],dist,eps=eps)) hit[1]],
|
||||
unorms = len(hitnorms) > 7
|
||||
? unique([for (nn = hitnorms) quant(nn,1e-9)])
|
||||
: [
|
||||
for (i = idx(hitnorms)) let(
|
||||
nn = hitnorms[i],
|
||||
isdup = [
|
||||
for (j = [i+1:1:len(hitnorms)-1])
|
||||
if (approx(nn, hitnorms[j])) 1
|
||||
] != []
|
||||
) if (!isdup) nn
|
||||
],
|
||||
n = unit(sum(unorms)),
|
||||
oang = approx(point2d(n), [0,0])? 0 : atan2(n.y, n.x) + 90
|
||||
)
|
||||
[anchor, pos, n, oang]
|
||||
) : type == "vnf_extent"? ( //vnf
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
BOSL_VERSION = [2,0,404];
|
||||
BOSL_VERSION = [2,0,405];
|
||||
|
||||
|
||||
// Section: BOSL Library Version Functions
|
||||
|
|
Loading…
Reference in a new issue