Skip to content

Latest commit

 

History

History
374 lines (314 loc) · 62 KB

File metadata and controls

374 lines (314 loc) · 62 KB
sidebar_position 3
title Edge Primitives
sidebar_label Edge Primitives
description Master the fundamentals of edge creation in OCCT - from simple lines and circles to complex arcs and ellipses. Learn multiple methods to create precise geometric boundaries for your 3D models.
tags
occt

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import BitByBitRenderCanvas from '@site/src/components/BitByBitRenderCanvas';

Edge Primitives

OCCT category icon with a stylized logo representation

Edge primitives are the fundamental building blocks for creating geometric boundaries in 3D modeling. In OCCT (Open CASCADE Technology), edges define the boundaries between faces and form the skeleton of complex 3D shapes. This tutorial covers the essential edge types you'll use in most modeling scenarios.

What You'll Learn

In this tutorial, you'll discover how to create:

  • Linear edges - straight lines between two points
  • Circular arcs - curved segments using various definition methods
  • Complete circles - closed circular boundaries
  • Elliptical edges - oval-shaped curves with dual radii

Each example is provided in three formats: Rete (visual node-based), Blockly (block-based), and TypeScript (code-based), so you can learn using your preferred approach.

Why Edge Primitives Matter

Understanding edge primitives is crucial because:

  • They form the boundaries of all 3D shapes
  • They enable precise geometric control in your models
  • They provide multiple creation methods for different design scenarios
  • They serve as the foundation for more complex geometric operations

Let's start with the most basic edge primitive - the line edge.


startPointendPointstartPoint-500endPoint500startPointendPointstartPointendPoint","version":"0.20.7","type":"blockly"}} title="Creating primitive solids" /> {\n // Create start and end points\n const startPoint: Point3 = [-5, 0, 0];\n const endPoint: Point3 = [5, 0, 0];\n\n // Create a line between the points\n const lineOptions = new LineDto();\n lineOptions.start = startPoint;\n lineOptions.end = endPoint;\n\n const line = await bitbybit.occt.shapes.edge.line(lineOptions);\n\n // Draw the line and points\n bitbybit.draw.drawAnyAsync({ entity: line });\n bitbybit.draw.drawAnyAsync({ entity: startPoint });\n bitbybit.draw.drawAnyAsync({ entity: endPoint });\n}\n\n// Execute the function\nstart();","version":"0.20.7","type":"typescript"}} title="Creating primitive solids" />

Line Edge

This example demonstrates how to create a simple straight line edge in 3D space. A line edge is the most basic type of edge primitive, defined by two points: a start point and an end point.

What's happening:

  • We define two points: startPoint at [-5, 0, 0] and endPoint at [5, 0, 0]
  • These points create a horizontal line along the X-axis, 10 units long
  • The LineDto object packages our start and end points for the OCCT line creation function
  • The result is a straight edge that can be used in more complex geometries or displayed on its own

Key concepts:

  • Start and End Points: Every line needs exactly two points to define its position and direction
  • 3D Coordinates: Points are specified as [x, y, z] coordinates in 3D space
  • Edge vs Line: An edge is a geometric boundary that can be part of a face or solid, while a line is the mathematical definition
startPointmidPointendPointstartPoint-500midPoint060endPoint500startPointmidPointendPointstartPointmidPointendPoint","version":"0.20.7","type":"blockly"}} title="Arc edge through 3 points" /> {\n // Create start and end points\n const startPoint: Point3 = [-5, 0, 0];\n const midPoint: Point3 = [0, 6, 0];\n const endPoint: Point3 = [5, 0, 0];\n\n // Create a arc between three points\n const arcOptions = new ArcEdgeThreePointsDto();\n arcOptions.start = startPoint;\n arcOptions.middle = midPoint;\n arcOptions.end = endPoint;\n\n const arc = await bitbybit.occt.shapes.edge.arcThroughThreePoints(arcOptions);\n\n // Draw the arc and points\n bitbybit.draw.drawAnyAsync({ entity: arc });\n bitbybit.draw.drawAnyAsync({ entity: [startPoint, midPoint, endPoint] });\n}\n\n// Execute the function\nstart();","version":"0.20.7","type":"typescript"}} title="Arc edge through 3 points" />

Arc Through Three Points

This example shows how to create an arc edge that passes through three specific points. This is one of the most intuitive ways to define an arc since you can directly control three points that the arc must pass through.

What's happening:

  • We define three points: startPoint at [-5, 0, 0], midPoint at [0, 6, 0], and endPoint at [5, 0, 0]
  • The arc starts at the first point, curves through the middle point, and ends at the third point
  • OCCT automatically calculates the circular arc that best fits these three points
  • The middle point determines how much the arc curves - higher Y values create more pronounced curves

Key concepts:

  • Three-Point Definition: The arc is uniquely defined by exactly three non-collinear points
  • Curve Direction: The order of points matters - the arc flows from start to middle to end
  • Geometric Constraint: The three points cannot be in a straight line (collinear) as this wouldn't define a unique arc
startPointvecEndPtendPointvectorstartPoint-500vecEndPt-230endPoint500vectorstartPointvecEndPtstartPointvectorendPointstartPointvecEndPtendPointstartPointvecEndPt","version":"0.20.7","type":"blockly"}} title="Arc edge from two points and tangent" /> {\n // Create start and end points\n const startPoint: Point3 = [-5, 0, 0];\n const vecEndPt: Point3 = [-2, 3, 0];\n const endPoint: Point3 = [5, 0, 0];\n\n // Create tangent vector\n const vecOpt = new TwoVectorsDto();\n vecOpt.first = startPoint;\n vecOpt.second = vecEndPt;\n const vector = bitbybit.vector.sub(vecOpt) as Vector3;\n\n // Create an arc\n const arcOptions = new ArcEdgeTwoPointsTangentDto();\n arcOptions.start = startPoint;\n arcOptions.tangentVec = vector;\n arcOptions.end = endPoint;\n\n const arc = await bitbybit.occt.shapes.edge.arcThroughTwoPointsAndTangent(arcOptions);\n\n // Draw the arc, points and tangent\n bitbybit.draw.drawAnyAsync({ entity: arc });\n bitbybit.draw.drawAnyAsync({ entity: [startPoint, vecEndPt, endPoint] });\n\n // When two points are provided Bitbybit draws them as a line segment\n bitbybit.draw.drawAnyAsync({ entity: [startPoint, vecEndPt] });\n}\n\n// Execute the function\nstart();","version":"0.20.7","type":"typescript"}} title="Arc edge from two points and tangent" />

Arc From Two Points and Tangent

This example demonstrates creating an arc using two endpoints and a tangent vector that controls the arc's curvature at the start point. This method gives you precise control over both the arc's endpoints and its initial direction.

What's happening:

  • We define two endpoints: startPoint at [-5, 0, 0] and endPoint at [5, 0, 0]
  • We create a tangent vector by subtracting two points: from startPoint to vecEndPt at [-2, 3, 0]
  • This tangent vector controls how the arc curves away from the start point
  • The arc begins at the start point, follows the tangent direction initially, then curves to reach the end point

Key concepts:

  • Tangent Vector: Defines the direction the arc travels when leaving the start point
  • Vector Calculation: We calculate the tangent by finding the direction from one point to another
  • Curvature Control: The tangent vector's direction and magnitude influence how sharply the arc curves
  • Helper Visualization: The example draws additional lines to show the tangent direction and reference points
circlestartPointendPointcenterPointarccircle5000010startPoint800endPoint808centerPoint000arccirclestartPointendPointTRUEarccenterPointstartPointcenterPointendPointstartPointcenterPointendPoint","version":"0.20.7","type":"blockly"}} title="Arc edge from circle and two points" /> {\n // Create a circle edge\n const circleOptions = new CircleDto();\n circleOptions.radius = 5;\n circleOptions.center = [0, 0, 0] as Point3;\n circleOptions.direction = [0, 1, 0] as Vector3;\n\n const circle = await bitbybit.occt.shapes.edge.createCircleEdge(circleOptions);\n\n // Create start and end points for the arc\n const startPoint: Point3 = [8, 0, 0];\n const endPoint: Point3 = [8, 0, 8];\n const centerPoint: Point3 = [0, 0, 0];\n\n // Create arc from circle and two points\n const arcOptions = new ArcEdgeCircleTwoPointsDto();\n arcOptions.circle = circle;\n arcOptions.start = startPoint;\n arcOptions.end = endPoint;\n arcOptions.sense = true;\n\n const arc = await bitbybit.occt.shapes.edge.arcFromCircleAndTwoPoints(arcOptions);\n // Draw the arc and helper points\n bitbybit.draw.drawAnyAsync({ entity: arc });\n bitbybit.draw.drawAnyAsync({ entity: [endPoint, centerPoint, startPoint] });\n bitbybit.draw.drawAnyAsync({ entity: [centerPoint, endPoint] });\n bitbybit.draw.drawAnyAsync({ entity: [centerPoint, startPoint] });\n}\n\n// Execute the function\nstart();","version":"0.20.7","type":"typescript"}} title="Arc edge from circle and two points" />

Arc From Circle and Two Points

This example shows how to create an arc by extracting a portion of an existing circle edge between two specified points. This method is useful when you want to create an arc that follows a specific circular path.

What's happening:

  • First, we create a complete circle edge with radius 5, centered at the origin
  • We define two points: startPoint at [8, 0, 0] and endPoint at [8, 0, 8]
  • The system finds where these points would intersect the circle (projected onto the circle if needed)
  • An arc is created along the circle's circumference between these two intersection points
  • Helper lines are drawn to visualize the relationship between the center and the arc endpoints

Key concepts:

  • Base Circle: The arc follows the exact curvature of the parent circle
  • Point Projection: Points are projected onto the circle to find valid start/end positions
  • Arc Direction: The sense parameter controls whether the arc goes clockwise or counterclockwise
  • Geometric Relationship: The resulting arc maintains the same radius and center as the original circle
500001045270TRUE","version":"0.20.7","type":"blockly"}} title="Arc edge from circle and two points" /> {\n // Create a circle edge\n const circleOptions = new CircleDto();\n circleOptions.radius = 5;\n circleOptions.center = [0, 0, 0] as Point3;\n circleOptions.direction = [0, 1, 0] as Vector3;\n\n const circle = await bitbybit.occt.shapes.edge.createCircleEdge(circleOptions);\n\n // Create arc from circle and two angles\n const arcOptions = new ArcEdgeCircleTwoAnglesDto();\n arcOptions.circle = circle;\n arcOptions.alphaAngle1 = 45;\n arcOptions.alphaAngle2 = 270;\n arcOptions.sense = true;\n\n const arc = await bitbybit.occt.shapes.edge.arcFromCircleAndTwoAngles(arcOptions);\n\n // Draw the arc\n bitbybit.draw.drawAnyAsync({ entity: arc });\n}\n\n// Execute the function\nstart();","version":"0.20.7","type":"typescript"}} title="Arc edge from circle and two angles" />

Arc From Circle and Two Angles

This example demonstrates creating an arc by specifying a base circle and two angular positions. This method provides precise control over the arc's span using angle measurements.

What's happening:

  • We start with a circle edge (radius 5, centered at origin)
  • Two angles are specified: alphaAngle1 at 45° and alphaAngle2 at 270°
  • The arc is created between these two angular positions on the circle
  • The result is a portion of the circle spanning from 45° to 270° (a 225° arc)

Key concepts:

  • Angular Definition: Angles are measured in degrees from a reference direction (typically the positive X-axis)
  • Arc Span: The difference between the two angles determines how much of the circle becomes the arc
  • Direction Control: The sense parameter determines if the arc goes from angle1 to angle2 or the other way
  • Precise Control: This method is ideal when you know exactly what angular portion of a circle you need
circlepointcenterPointarccircle5000010point808centerPoint000arccirclepoint360TRUEarccenterPointpointcenterPointpoint","version":"0.20.7","type":"blockly"}} title="Arc edge from circle point and an angle" /> {\n // Create a circle edge\n const circleOptions = new CircleDto();\n circleOptions.radius = 5;\n circleOptions.center = [0, 0, 0] as Point3;\n circleOptions.direction = [0, 1, 0] as Vector3;\n\n const circle = await bitbybit.occt.shapes.edge.createCircleEdge(circleOptions);\n\n // Create a point on the circle\n const point: Point3 = [8, 0, 8];\n const centerPoint: Point3 = [0, 0, 0];\n\n // Create arc from circle, point and angle\n const arcOptions = new ArcEdgeCirclePointAngleDto();\n arcOptions.circle = circle;\n arcOptions.point = point;\n arcOptions.alphaAngle = 360;\n arcOptions.sense = true;\n\n const arc = await bitbybit.occt.shapes.edge.arcFromCirclePointAndAngle(arcOptions);\n\n // Draw the arc and helper elements\n bitbybit.draw.drawAnyAsync({ entity: arc });\n bitbybit.draw.drawAnyAsync({ entity: [centerPoint, point] });\n bitbybit.draw.drawAnyAsync({ entity: [centerPoint] });\n bitbybit.draw.drawAnyAsync({ entity: [point] });\n\n}\n\n// Execute the function\nstart();","version":"0.20.7","type":"typescript"}} title="Arc edge from circle point and an angle" />

Arc From Circle, Point and Angle

This example shows how to create an arc starting from a specific point on a circle and extending through a specified angular distance. This method combines point-based positioning with angular measurement.

What's happening:

  • We create a base circle (radius 5, centered at origin)
  • A starting point is defined at [8, 0, 8] which gets projected onto the circle
  • An angle of 360° is specified, creating a complete circular arc (full circle)
  • The arc begins at the projected point location and sweeps through the specified angle
  • Helper elements show the center point, the reference point, and connecting lines

Key concepts:

  • Point Projection: The specified point is projected onto the circle to find the actual start position
  • Angular Sweep: The angle determines how far around the circle the arc extends
  • Complete Circle: A 360° angle creates a full circular arc, essentially recreating the original circle
  • Starting Position: Unlike other methods, this gives you control over exactly where on the circle the arc begins
5000010","version":"0.20.7","type":"blockly"}} title="Circle edge" /> {\n // Create a circle edge\n const circleOptions = new CircleDto();\n circleOptions.radius = 5;\n circleOptions.center = [0, 0, 0] as Point3;\n circleOptions.direction = [0, 1, 0] as Vector3;\n\n const circle = await bitbybit.occt.shapes.edge.createCircleEdge(circleOptions);\n\n // Draw the circle\n bitbybit.draw.drawAnyAsync({ entity: circle });\n}\n\n// Execute the function\nstart();","version":"0.20.7","type":"typescript"}} title="Circle edge" />

Circle Edge

This example demonstrates creating a complete circular edge, which is one of the most fundamental curved primitives in 3D modeling. A circle edge represents a perfect circular boundary that can be used as a standalone geometry or as part of more complex shapes.

What's happening:

  • We define a circle with radius 5 units, centered at the origin [0, 0, 0]
  • The direction vector [0, 1, 0] specifies that the circle lies in a plane perpendicular to the Y-axis (horizontal plane)
  • The CircleDto object packages all the circle parameters for the OCCT creation function
  • The result is a complete circular edge that forms a closed loop

Key concepts:

  • Radius: Determines the size of the circle (distance from center to edge)
  • Center Point: The position in 3D space where the circle is located
  • Direction Vector: Defines the orientation of the plane containing the circle
  • Closed Curve: A circle is a closed curve, meaning it has no start or end points
000010310","version":"0.20.7","type":"blockly"}} title="Ellipse edge" /> {\n // Create an ellipse edge\n const ellipseOptions = new EllipseDto();\n ellipseOptions.center = [0, 0, 0] as Point3;\n ellipseOptions.direction = [0, 1, 0] as Vector3;\n ellipseOptions.radiusMinor = 3;\n ellipseOptions.radiusMajor = 10;\n\n const ellipse = await bitbybit.occt.shapes.edge.createEllipseEdge(ellipseOptions);\n\n // Draw the ellipse\n bitbybit.draw.drawAnyAsync({ entity: ellipse });\n}\n\n// Execute the function\nstart();","version":"0.20.7","type":"typescript"}} title="Ellipse edge" />

Ellipse Edge

This example demonstrates creating an elliptical edge, which is an oval-shaped curve that extends the concept of a circle to have two different radii. Ellipses are commonly used in technical drawings and 3D modeling for creating elongated circular shapes.

What's happening:

  • We define an ellipse centered at the origin [0, 0, 0]
  • The direction vector [0, 1, 0] specifies the orientation plane (horizontal, like the circle)
  • Two radii are specified: radiusMinor = 3 (shorter radius) and radiusMajor = 10 (longer radius)
  • The result is an oval shape that is 20 units wide and 6 units tall
  • The EllipseDto object packages all parameters for the OCCT creation function

Key concepts:

  • Major Radius: The longer radius that defines the ellipse's widest dimension
  • Minor Radius: The shorter radius that defines the ellipse's narrower dimension
  • Aspect Ratio: The relationship between major and minor radii determines how "stretched" the ellipse appears
  • Closed Curve: Like a circle, an ellipse is a closed curve with no endpoints
  • Geometric Relationship: When major and minor radii are equal, the ellipse becomes a perfect circle