Skip to content

helix / ScoreVec3

Class: ScoreVec3

Defined in: core/frontend/nodes/score_vec3.ts:19

Three scoreboard slots treated as a single vector, so vector algebra over scores reads as algebra instead of three near-identical scoreboard players operation lines per axis per step. Every method delegates to Score's typed ops and emits into the ambient context (the build/run/if callback you are inside); pass ctx to override it, exactly like Score.

It holds references to three existing Score slots and allocates nothing - the caller owns where each component lives. That makes one class serve both roles a score-vector takes: a value (three per-player objectives bound to a selector, e.g. an anchor position) and a scratch register (three slots on a work objective). Scores are integers, so divide floors toward −∞.

Chainable like Score: v.assign(a).sub(b).scale(k).

Constructors

Constructor

new ScoreVec3(x, y, z): ScoreVec3

Defined in: core/frontend/nodes/score_vec3.ts:20

Parameters

x

Score

y

Score

z

Score

Returns

ScoreVec3

Properties

x

readonly x: Score

Defined in: core/frontend/nodes/score_vec3.ts:21


y

readonly y: Score

Defined in: core/frontend/nodes/score_vec3.ts:22


z

readonly z: Score

Defined in: core/frontend/nodes/score_vec3.ts:23

Accessors

components

Get Signature

get components(): readonly [Score, Score, Score]

Defined in: core/frontend/nodes/score_vec3.ts:27

The three components as a tuple (e.g. for store result score reads).

Returns

readonly [Score, Score, Score]

Methods

add()

add(other, ctx?): this

Defined in: core/frontend/nodes/score_vec3.ts:40

this += other.

Parameters

other

ScoreVec3

ctx?

FunctionContext

Returns

this


assign()

assign(other, ctx?): this

Defined in: core/frontend/nodes/score_vec3.ts:32

this = other (component-wise =).

Parameters

other

ScoreVec3

ctx?

FunctionContext

Returns

this


clamp()

clamp(lo, hi, ctx?): this

Defined in: core/frontend/nodes/score_vec3.ts:72

Clamp every axis into [lo, hi] (< hi then > lo).

Parameters

lo

Score

hi

Score

ctx?

FunctionContext

Returns

this


divide()

divide(k, ctx?): this

Defined in: core/frontend/nodes/score_vec3.ts:64

Divide every axis by the scalar score k (/=, integer floor).

Parameters

k

Score

ctx?

FunctionContext

Returns

this


dot()

dot(other, out, scratch, ctx?): Score

Defined in: core/frontend/nodes/score_vec3.ts:85

Dot product into out, using scratch for the cross terms - both caller-owned scalar slots, distinct from this vector's components:

out = x·o.x + y·o.y + z·o.z

Parameters

other

ScoreVec3

out

Score

scratch

Score

ctx?

FunctionContext

Returns

Score


lengthSquared()

lengthSquared(out, scratch, ctx?): Score

Defined in: core/frontend/nodes/score_vec3.ts:100

Squared length |v|² = v·v (into out, via scratch).

Parameters

out

Score

scratch

Score

ctx?

FunctionContext

Returns

Score


scale()

scale(k, ctx?): this

Defined in: core/frontend/nodes/score_vec3.ts:56

Scale every axis by the scalar score k (*=).

Parameters

k

Score

ctx?

FunctionContext

Returns

this


sub()

sub(other, ctx?): this

Defined in: core/frontend/nodes/score_vec3.ts:48

this -= other.

Parameters

other

ScoreVec3

ctx?

FunctionContext

Returns

this

Released under the MIT License · Credits