本文整理汇总了TypeScript中core/hittest.validate_bbox_coords函数的典型用法代码示例。如果您正苦于以下问题:TypeScript validate_bbox_coords函数的具体用法?TypeScript validate_bbox_coords怎么用?TypeScript validate_bbox_coords使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了validate_bbox_coords函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: _mask_data
_mask_data(_all_indices) {
let sx0, sx1, sy0, sy1, x0, x1, y0, y1;
const [hr, vr] = this.renderer.plot_view.frame.bbox.ranges;
// check for radius first
if ((this._radius != null) && (this.model.properties.radius.units === "data")) {
sx0 = hr.start;
sx1 = hr.end;
[x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);
x0 -= this.max_radius;
x1 += this.max_radius;
sy0 = vr.start;
sy1 = vr.end;
[y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);
y0 -= this.max_radius;
y1 += this.max_radius;
} else {
sx0 = hr.start - this.max_size;
sx1 = hr.end + this.max_size;
[x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);
sy0 = vr.start - this.max_size;
sy1 = vr.end + this.max_size;
[y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);
}
const bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);
return this.index.indices(bbox);
}
开发者ID:FourtekIT-incubator,项目名称:bokeh,代码行数:31,代码来源:circle.ts
示例2: _hit_point
protected _hit_point(geometry: PointGeometry): Selection {
const {sx, sy} = geometry
const x = this.renderer.xscale.invert(sx)
const x0 = x - this.max_outer_radius
const x1 = x + this.max_outer_radius
const y = this.renderer.yscale.invert(sy)
const y0 = y - this.max_outer_radius
const y1 = y + this.max_outer_radius
const hits: [number, number][] = []
const bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1])
for (const i of this.index.indices(bbox)) {
const or2 = Math.pow(this.souter_radius[i], 2)
const ir2 = Math.pow(this.sinner_radius[i], 2)
const [sx0, sx1] = this.renderer.xscale.r_compute(x, this._x[i])
const [sy0, sy1] = this.renderer.yscale.r_compute(y, this._y[i])
const dist = Math.pow(sx0 - sx1, 2) + Math.pow(sy0 - sy1, 2)
if (dist <= or2 && dist >= ir2)
hits.push([i, dist])
}
return hittest.create_hit_test_result_from_hits(hits)
}
开发者ID:Zyell,项目名称:bokeh,代码行数:25,代码来源:annulus.ts
示例3: _hit_point
_hit_point(geometry) {
const {sx, sy} = geometry;
const x = this.renderer.xscale.invert(sx);
const x0 = x - this.max_radius;
const x1 = x + this.max_radius;
const y = this.renderer.yscale.invert(sy);
const y0 = y - this.max_radius;
const y1 = y + this.max_radius;
const hits = [];
const bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);
for (const i of this.index.indices(bbox)) {
const or2 = Math.pow(this.souter_radius[i], 2);
const ir2 = Math.pow(this.sinner_radius[i], 2);
const [sx0, sx1] = this.renderer.xscale.r_compute(x, this._x[i]);
const [sy0, sy1] = this.renderer.yscale.r_compute(y, this._y[i]);
const dist = Math.pow(sx0-sx1, 2) + Math.pow(sy0-sy1, 2);
if ((dist <= or2) && (dist >= ir2)) {
hits.push([i, dist]);
}
}
return hittest.create_1d_hit_test_result(hits);
}
开发者ID:FourtekIT-incubator,项目名称:bokeh,代码行数:26,代码来源:annulus.ts
示例4: _mask_data
protected _mask_data(): number[] {
const [hr, vr] = this.renderer.plot_view.frame.bbox.ranges
let x0: number, y0: number
let x1: number, y1: number
if (this._radius != null && this.model.properties.radius.units == "data") {
const sx0 = hr.start
const sx1 = hr.end
;[x0, x1] = this.renderer.xscale.r_invert(sx0, sx1)
x0 -= this.max_radius
x1 += this.max_radius
const sy0 = vr.start
const sy1 = vr.end
;[y0, y1] = this.renderer.yscale.r_invert(sy0, sy1)
y0 -= this.max_radius
y1 += this.max_radius
} else {
const sx0 = hr.start - this.max_size
const sx1 = hr.end + this.max_size
;[x0, x1] = this.renderer.xscale.r_invert(sx0, sx1)
const sy0 = vr.start - this.max_size
const sy1 = vr.end + this.max_size
;[y0, y1] = this.renderer.yscale.r_invert(sy0, sy1)
}
const bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1])
return this.index.indices(bbox)
}
开发者ID:digitalsatori,项目名称:Bokeh,代码行数:30,代码来源:circle.ts
示例5: _hit_span
_hit_span(geometry) {
let ms, x0, x1, y0, y1;
const {sx, sy} = geometry;
const {minX, minY, maxX, maxY} = this.bounds();
const result = hittest.create_hit_test_result();
if (geometry.direction === 'h') {
y0 = minY;
y1 = maxY;
ms = this.max_size/2;
const sx0 = sx - ms;
const sx1 = sx + ms;
[x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);
} else {
x0 = minX;
x1 = maxX;
ms = this.max_size/2;
const sy0 = sy - ms;
const sy1 = sy + ms;
[y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);
}
const bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);
const hits = this.index.indices(bbox);
result['1d'].indices = hits;
return result;
}
开发者ID:FourtekIT-incubator,项目名称:bokeh,代码行数:28,代码来源:marker.ts
示例6: _hit_span
protected _hit_span(geometry: SpanGeometry): Selection {
const {sx, sy} = geometry
const {minX, minY, maxX, maxY} = this.bounds()
const result = hittest.create_empty_hit_test_result()
let x0: number, x1: number
let y0: number, y1: number
if (geometry.direction == 'h') {
y0 = minY
y1 = maxY
const ms = this.max_size/2
const sx0 = sx - ms
const sx1 = sx + ms
;[x0, x1] = this.renderer.xscale.r_invert(sx0, sx1)
} else {
x0 = minX
x1 = maxX
const ms = this.max_size/2
const sy0 = sy - ms
const sy1 = sy + ms
;[y0, y1] = this.renderer.yscale.r_invert(sy0, sy1)
}
const bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1])
const hits = this.index.indices(bbox)
result.indices = hits
return result
}
开发者ID:Zyell,项目名称:bokeh,代码行数:29,代码来源:marker.ts
示例7: _hit_rect
_hit_rect(geometry) {
const {sx0, sx1, sy0, sy1} = geometry;
const [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);
const [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);
const bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);
const result = hittest.create_hit_test_result();
result['1d'].indices = this.index.indices(bbox);
return result;
}
开发者ID:FourtekIT-incubator,项目名称:bokeh,代码行数:9,代码来源:marker.ts
示例8: _hit_rect
protected _hit_rect(geometry: RectGeometry): Selection {
const {sx0, sx1, sy0, sy1} = geometry
const [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1)
const [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1)
const bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1])
const result = hittest.create_empty_hit_test_result()
result.indices = this.index.indices(bbox)
return result
}
开发者ID:Zyell,项目名称:bokeh,代码行数:9,代码来源:marker.ts
示例9: _hit_point
_hit_point(geometry) {
let {sx, sy} = geometry;
const x = this.renderer.xscale.invert(sx);
const y = this.renderer.yscale.invert(sy);
const scenter_x = ((() => {
const result1 = [];
for (let i = 0, end = this.sx0.length; i < end; i++) {
result1.push(this.sx0[i] + (this.sw[i]/2));
}
return result1;
})());
const scenter_y = ((() => {
const result2 = [];
for (let i = 0, end = this.sy1.length; i < end; i++) {
result2.push(this.sy1[i] + (this.sh[i]/2));
}
return result2;
})());
const max_x2_ddist = max(this._ddist(0, scenter_x, this.ssemi_diag));
const max_y2_ddist = max(this._ddist(1, scenter_y, this.ssemi_diag));
const x0 = x - max_x2_ddist;
const x1 = x + max_x2_ddist;
const y0 = y - max_y2_ddist;
const y1 = y + max_y2_ddist;
const hits = [];
const bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);
for (const i of this.index.indices(bbox)) {
let height_in, width_in;
if (this._angle[i]) {
const s = Math.sin(-this._angle[i]);
const c = Math.cos(-this._angle[i]);
const px = ((c * (sx-this.sx[i])) - (s * (sy-this.sy[i]))) + this.sx[i];
const py = (s * (sx-this.sx[i])) + (c * (sy-this.sy[i])) + this.sy[i];
sx = px;
sy = py;
width_in = Math.abs(this.sx[i]-sx) <= (this.sw[i]/2);
height_in = Math.abs(this.sy[i]-sy) <= (this.sh[i]/2);
} else {
width_in = ((sx - this.sx0[i]) <= this.sw[i]) && ((sx - this.sx0[i]) >= 0);
height_in = ((sy - this.sy1[i]) <= this.sh[i]) && ((sy - this.sy1[i]) >= 0);
}
if (height_in && width_in) {
hits.push(i);
}
}
const result = hittest.create_hit_test_result();
result['1d'].indices = hits;
return result;
}
开发者ID:FourtekIT-incubator,项目名称:bokeh,代码行数:56,代码来源:rect.ts
示例10: _hit_point
_hit_point(geometry) {
let dist, r2, sx0, sx1, sy0, sy1, x0, x1, y0, y1;
const {sx, sy} = geometry;
const x = this.renderer.xscale.invert(sx);
const y = this.renderer.yscale.invert(sy);
// check radius first
if ((this._radius != null) && (this.model.properties.radius.units === "data")) {
x0 = x - this.max_radius;
x1 = x + this.max_radius;
y0 = y - this.max_radius;
y1 = y + this.max_radius;
} else {
sx0 = sx - this.max_size;
sx1 = sx + this.max_size;
[x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);
[x0, x1] = [Math.min(x0, x1), Math.max(x0, x1)];
sy0 = sy - this.max_size;
sy1 = sy + this.max_size;
[y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);
[y0, y1] = [Math.min(y0, y1), Math.max(y0, y1)];
}
const bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);
const candidates = this.index.indices(bbox);
const hits = [];
if ((this._radius != null) && (this.model.properties.radius.units === "data")) {
for (const i of candidates) {
r2 = Math.pow(this.sradius[i], 2);
[sx0, sx1] = this.renderer.xscale.r_compute(x, this._x[i]);
[sy0, sy1] = this.renderer.yscale.r_compute(y, this._y[i]);
dist = Math.pow(sx0-sx1, 2) + Math.pow(sy0-sy1, 2);
if (dist <= r2) {
hits.push([i, dist]);
}
}
} else {
for (const i of candidates) {
r2 = Math.pow(this.sradius[i], 2);
dist = Math.pow(this.sx[i]-sx, 2) + Math.pow(this.sy[i]-sy, 2);
if (dist <= r2) {
hits.push([i, dist]);
}
}
}
return hittest.create_1d_hit_test_result(hits);
}
开发者ID:FourtekIT-incubator,项目名称:bokeh,代码行数:52,代码来源:circle.ts
注:本文中的core/hittest.validate_bbox_coords函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论