UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

45 lines (44 loc) 1.05 kB
"use strict"; import { Vector2 } from "three"; import { _sizzleVec3XY, _sizzleVec3XZ, _sizzleVec3YZ } from "./_Sizzle"; import { NamedFunction4 } from "./_Base"; const _sizzle2 = new Vector2(); export class SDFRevolutionX extends NamedFunction4 { static type() { return "SDFRevolutionX"; } func(p, center, o, target) { p.sub(center); _sizzleVec3YZ(p, _sizzle2); const l = _sizzle2.length(); target.x = l - o; target.y = p.x; return target; } } export class SDFRevolutionY extends NamedFunction4 { static type() { return "SDFRevolutionY"; } func(p, center, o, target) { p.sub(center); _sizzleVec3XZ(p, _sizzle2); const l = _sizzle2.length(); target.x = l - o; target.y = p.y; return target; } } export class SDFRevolutionZ extends NamedFunction4 { static type() { return "SDFRevolutionZ"; } func(p, center, o, target) { p.sub(center); _sizzleVec3XY(p, _sizzle2); const l = _sizzle2.length(); target.x = l - o; target.y = p.z; return target; } }