1"use strict"; 2/* 3 * Copyright (c) 2022-2025 Huawei Device Co., Ltd. 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16Object.defineProperty(exports, "__esModule", { value: true }); 17exports.Point3 = void 0; 18class Point3 { 19 constructor(x, y, z) { 20 this.x = x; 21 this.y = y; 22 this.z = z; 23 } 24 subtract(value) { 25 return new Point3(this.x - value.x, this.y - value.y, this.z - value.z); 26 } 27 cross(value) { 28 return new Point3(this.y * value.z - this.z * value.y, this.z * value.x - this.x * value.z, this.x * value.y - this.y * value.x); 29 } 30 normalize() { 31 const mag = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); 32 const tolerance = (1.0 / (1 << 12)); 33 if (mag < tolerance) { 34 // This semicolon after return this is a workaround for ArkTS bug 35 return this; 36 } 37 return new Point3(this.x / mag, this.y / mag, this.z / mag); 38 } 39} 40exports.Point3 = Point3; 41//# sourceMappingURL=Point3.js.map