Skip to content

Latest commit

 

History

History
86 lines (70 loc) · 3.52 KB

File metadata and controls

86 lines (70 loc) · 3.52 KB
title axisEdge
description Rotate a placed model about one of its own straight topology edges.
sourceReview
packageVersion sources
0.0.1-alpha.16
path sha256 commit
packages/core/src/library/axis-edge.ts
78760cbd39c9647ec89e57f0d35f3adf83c96fcd491b62ddfe6dea59dcbddff0
757c8003e4ef2c3e4b4e85561e186a82a1dd1c39
path sha256
packages/core/src/library/runtime.ts
dcee3d2388a9b7b3819bb4897edd894463daa0e5b519e832a3349fac98c3bff8
path sha256 commit
packages/core/src/library/topology.ts
f9f0d048fe30cc80046a25123aa8101ca51e85cdb5b2e66260c6a68f43f84715
67228dd8559d584852df7bfbd47ed89f1d8003e9
path sha256 commit
packages/core/src/library/topology-id.ts
49b2812aa89e5a886759166c89e32cf01a629fe888bcc57452ede2feeba7dc01
904463d8c4405f4a2b1c073ba9a5edc997732e23
path sha256 commit
packages/core/src/library/spatial.ts
810c4fa69352c26c32fb04a0e7867f6327698e02f3212669f17d777784322a78
69d231fb775befdb3cd098291b4097ccd52d8966
sidebar
hidden
true
head
tag content
title
axisEdge — Code3D TypeScript API reference

Rotate a placed model about one of its own straight topology edges.

Example

import {axisEdge, box, group, on} from '@code3d/core';

const edgeBase = box(32, 4, 24);
const edgePart = box(12, 10, 8).relate(() => [
  on(edgeBase.up),
  axisEdge(2).rotate(40),
]);
export const edgeAxisAssembly = group([edgeBase, edgePart]);

Rotate a placed model about one of its own straight topology edges.

Complete example: groups and placement.

Signature

function axisEdge(id: EdgeId): AxisChain;
chain.axisOffset(x: number, y: number, z: number): AxisRotation;
chain.rotate(angle: number): Transformation;

Import the functions and named types from @code3d/core.

Edge selection

id selects an edge belonging to the callback's self. Use a positive integer or an inherited path of at least two positive integers. Unknown, retired or malformed IDs fail. The edge must be straight: a curved edge does not define one rotation axis. The supporting line extends beyond the finite edge's endpoints.

The example turns around the input box's E2. Edge direction determines the positive angular sense. To explicitly reverse a chosen reference, use axisLine with self.edge(id).reverse().

A group or sketch has no aggregate model edge IDs. Use axisLine with a member's straight edge or another positioned line reference. For self-local XYZ rotation about a point, use pivotVertex.

Offset and rotate

AxisChain provides .rotate(angle) directly, or one .axisOffset(x, y, z) followed by .rotate(angle). The offset returns AxisRotation, which supports the final rotation but no further axisOffset. Components are finite distances in the selected axis's reference frame. Moving along the axis itself does not change the rotation. Offset changes the selected line's position while retaining its direction; it does not directly translate self.

angle is a finite signed degree value, positive by the right-hand rule about the directed axis. Negative and multi-turn values are allowed. Required numeric arguments use zero defaults only while the App edits incomplete calls. The final result is one complete Transformation for relate. Finish selectors before returning them from the callback. Later transformations are separate entries; the chosen axis applies to this rotation only.