Skip to main content

Edge Constraints

OCCT category icon with a stylized logo representation

Edge constraints in OCCT (Open CASCADE Technology) provide powerful geometric constraint solving capabilities for creating tangent lines and circles based on existing geometric entities. These operations are essential for parametric modeling, geometric construction, and constraint-based design workflows.

Overview

Edge constraints help you create geometry that follows specific rules or relationships with existing shapes. Think of them as intelligent drawing tools that automatically calculate where new lines or circles should be placed to maintain tangent relationships with your existing geometry.

The system offers five main constraint operations that solve common geometric problems. You can create tangent lines between points and circles, tangent lines between two circles, and even tangent circles that touch existing circles or points. Each operation automatically calculates the mathematically correct positions and orientations.

Understanding the Examples

Each constraint operation is demonstrated using three different programming approaches. The Rete interface lets you build constraint solutions visually by connecting nodes. Blockly provides a block-based approach that's great for learning the logical flow. TypeScript gives you direct code control for advanced customization and integration into larger projects.

All examples use similar patterns - they create the base geometry (circles and points), set up the constraint parameters, execute the constraint operation, and then display the results. The constraint functions handle all the complex mathematical calculations automatically.

Working with Tolerance and Precision

Most constraint operations include a tolerance setting that controls how precisely the calculations are performed. The default value works well for most situations, but you might need to adjust it when working with very large or very small geometry. Think of tolerance as how "strict" the geometric relationships need to be.

Constraint Tangent Lines from Two Points to Circle

This operation solves a classic geometric problem: given two points and a circle, find the lines that connect both points and are tangent to the circle. The function automatically calculates all possible solutions and returns the tangent lines.

This is particularly useful in mechanical design when you need to connect two specific locations with smooth curves that don't intersect existing circular features.

Bitbybit Platform

Constraint tangent lines from two points to circle

rete logoRete
Script Source (rete)
{
"id": "rete-v2-json",
"nodes": {
"0be30c1a2380af3a": {
"id": "0be30c1a2380af3a",
"name": "bitbybit.occt.shapes.edge.constraintTanLinesFromTwoPtsToCircle",
"customName": "constraint tan lines from two pts to circle",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"tolerance": 1e-7,
"positionResult": "all",
"circleRemainder": "none"
},
"inputs": {
"point2": {
"connections": [
{
"node": "9beccb7e88a01228",
"output": "result",
"data": {}
}
]
},
"point1": {
"connections": [
{
"node": "249f184a4a2d34a2",
"output": "result",
"data": {}
}
]
},
"circle": {
"connections": [
{
"node": "be968690cada3446",
"output": "result",
"data": {}
}
]
}
},
"position": [
1964.2421845834122,
707.6536356095846
]
},
"be968690cada3446": {
"id": "be968690cada3446",
"name": "bitbybit.occt.shapes.edge.createCircleEdge",
"customName": "circle edge",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 4,
"center": [
0,
0,
0
],
"direction": [
0,
1,
0
]
},
"inputs": {},
"position": [
1274.4210202419606,
397.62302689075284
]
},
"9beccb7e88a01228": {
"id": "9beccb7e88a01228",
"name": "bitbybit.point.pointXYZ",
"customName": "point xyz",
"async": false,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"x": 9,
"y": 0,
"z": 9
},
"inputs": {},
"position": [
1270.789651089078,
1103.1208819773626
]
},
"249f184a4a2d34a2": {
"id": "249f184a4a2d34a2",
"name": "bitbybit.point.pointXYZ",
"customName": "point xyz",
"async": false,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"x": 0,
"y": 0,
"z": 7
},
"inputs": {},
"position": [
1271.2543385554595,
752.6047103743216
]
}
}
}

Constraint Tangent Lines from Point to Circle

When you need to draw lines from a single point that just touch a circle without crossing it, this constraint operation provides the solution. It's simpler than the two-point version and automatically finds both possible tangent lines from your point to the circle.

This operation is commonly used in architectural drawings when you need to create sight lines or in mechanical design for clearance calculations.

Bitbybit Platform

Constraint tangent lines from point to circle

rete logoRete
Script Source (rete)
{
"id": "rete-v2-json",
"nodes": {
"be968690cada3446": {
"id": "be968690cada3446",
"name": "bitbybit.occt.shapes.edge.createCircleEdge",
"customName": "circle edge",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 4,
"center": [
0,
0,
0
],
"direction": [
0,
1,
0
]
},
"inputs": {},
"position": [
1274.4210202419606,
397.62302689075284
]
},
"249f184a4a2d34a2": {
"id": "249f184a4a2d34a2",
"name": "bitbybit.point.pointXYZ",
"customName": "point xyz",
"async": false,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"x": 8,
"y": 0,
"z": 7
},
"inputs": {},
"position": [
1271.2543385554595,
752.6047103743216
]
},
"592dbbb1c41d8690": {
"id": "592dbbb1c41d8690",
"name": "bitbybit.occt.shapes.edge.constraintTanLinesFromPtToCircle",
"customName": "constraint tan lines from pt to circle",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"tolerance": 1e-7,
"positionResult": "all",
"circleRemainder": "none"
},
"inputs": {
"circle": {
"connections": [
{
"node": "be968690cada3446",
"output": "result",
"data": {}
}
]
},
"point": {
"connections": [
{
"node": "249f184a4a2d34a2",
"output": "result",
"data": {}
}
]
}
},
"position": [
1824.4560970772618,
562.1674808007256
]
}
}
}

Constraint Tangent Lines on Two Circles

This operation finds all the lines that touch two circles without crossing them. Depending on how the circles are positioned relative to each other, you might get external tangent lines (that don't pass between the circles) or internal tangent lines (that cross between them).

This is especially valuable in gear design, pulley systems, or any mechanical application where you need smooth transitions between circular components.

Bitbybit Platform

Constraint tangent lines on two circles

rete logoRete
Script Source (rete)
{
"id": "rete-v2-json",
"nodes": {
"be968690cada3446": {
"id": "be968690cada3446",
"name": "bitbybit.occt.shapes.edge.createCircleEdge",
"customName": "circle edge",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 3,
"center": [
0,
0,
0
],
"direction": [
0,
1,
0
]
},
"inputs": {},
"position": [
683.1370467145987,
165.9470538854013
]
},
"a8c5b2c7d1a9e3f4": {
"id": "a8c5b2c7d1a9e3f4",
"name": "bitbybit.occt.shapes.edge.createCircleEdge",
"customName": "circle edge",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 2,
"center": [
0,
0,
0
],
"direction": [
0,
1,
0
]
},
"inputs": {
"center": {
"connections": [
{
"node": "885c6bb2a3ed276b",
"output": "result",
"data": {}
}
]
}
},
"position": [
685.6543210987654,
654.3210987654321
]
},
"f9b3c6d8e4a7f5b2": {
"id": "f9b3c6d8e4a7f5b2",
"name": "bitbybit.occt.shapes.edge.constraintTanLinesOnTwoCircles",
"customName": "constraint tan lines on two circles",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"tolerance": 1e-7,
"positionResult": "all",
"circleRemainders": "none"
},
"inputs": {
"circle1": {
"connections": [
{
"node": "be968690cada3446",
"output": "result",
"data": {}
}
]
},
"circle2": {
"connections": [
{
"node": "a8c5b2c7d1a9e3f4",
"output": "result",
"data": {}
}
]
}
},
"position": [
1249.6118955520265,
407.9391878009695
]
},
"885c6bb2a3ed276b": {
"id": "885c6bb2a3ed276b",
"name": "bitbybit.vector.vectorXYZ",
"customName": "vector xyz",
"async": false,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"x": 7,
"y": 0,
"z": 0
},
"inputs": {},
"position": [
306.92934870803884,
696.3229806735962
]
}
}
}

Constraint Tangent Circles on Two Circles

Sometimes you need to create circles that touch two existing circles. This operation calculates where to place new circles of a specified size so they're tangent to both input circles. You control the radius of the new circles, and the system figures out all the valid positions.

This is particularly useful for creating buffer zones around existing circular features or for designing complex mechanical linkages where multiple circular components need to interact smoothly.

Bitbybit Platform

Constraint tangent circles on two circles

rete logoRete
Script Source (rete)
{
"id": "rete-v2-json",
"nodes": {
"a1b2c3d4e5f6g7h8": {
"id": "a1b2c3d4e5f6g7h8",
"name": "bitbybit.occt.shapes.edge.createCircleEdge",
"customName": "circle edge",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 3,
"center": [
0,
0,
0
],
"direction": [
0,
1,
0
]
},
"inputs": {},
"position": [
683.1370467145987,
165.9470538854013
]
},
"b2c3d4e5f6g7h8i9": {
"id": "b2c3d4e5f6g7h8i9",
"name": "bitbybit.occt.shapes.edge.createCircleEdge",
"customName": "circle edge",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 1.5,
"center": [
0,
0,
0
],
"direction": [
0,
1,
0
]
},
"inputs": {
"center": {
"connections": [
{
"node": "9fb306c7e1feb87a",
"output": "result",
"data": {}
}
]
}
},
"position": [
685.6543210987654,
654.3210987654321
]
},
"c3d4e5f6g7h8i9j0": {
"id": "c3d4e5f6g7h8i9j0",
"name": "bitbybit.occt.shapes.edge.constraintTanCirclesOnTwoCircles",
"customName": "constraint tan circles on two circles",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"tolerance": 1e-7,
"radius": 0.8
},
"inputs": {
"circle1": {
"connections": [
{
"node": "a1b2c3d4e5f6g7h8",
"output": "result",
"data": {}
}
]
},
"circle2": {
"connections": [
{
"node": "b2c3d4e5f6g7h8i9",
"output": "result",
"data": {}
}
]
}
},
"position": [
1224.2595753955707,
414.59942527677146
]
},
"9fb306c7e1feb87a": {
"id": "9fb306c7e1feb87a",
"name": "bitbybit.vector.vectorXYZ",
"customName": "vector xyz",
"async": false,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"x": 5,
"y": 0,
"z": 0
},
"inputs": {},
"position": [
297.6273751492513,
695.974022780083
]
}
}
}

Constraint Tangent Circles on Circle and Point

This operation creates circles that touch an existing circle and are positioned relative to a specific point. The new circles will be tangent to your input circle and either pass through the point or maintain a specific relationship with it, depending on the radius you specify.

This constraint is perfect for creating rounded transitions in designs where you need a smooth connection between a circular feature and a specific location in your model.

Bitbybit Platform

Constraint tangent circles on circle and point

rete logoRete
Script Source (rete)
{
"id": "rete-v2-json",
"nodes": {
"d4e5f6g7h8i9j0k1": {
"id": "d4e5f6g7h8i9j0k1",
"name": "bitbybit.occt.shapes.edge.createCircleEdge",
"customName": "circle edge",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 3,
"center": [
0,
0,
0
],
"direction": [
0,
1,
0
]
},
"inputs": {},
"position": [
683.1370467145987,
165.9470538854013
]
},
"e5f6g7h8i9j0k1l2": {
"id": "e5f6g7h8i9j0k1l2",
"name": "bitbybit.point.pointXYZ",
"customName": "point xyz",
"async": false,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"x": 4,
"y": 0,
"z": 0
},
"inputs": {},
"position": [
683.6543210987654,
654.3210987654321
]
},
"f6g7h8i9j0k1l2m3": {
"id": "f6g7h8i9j0k1l2m3",
"name": "bitbybit.occt.shapes.edge.constraintTanCirclesOnCircleAndPnt",
"customName": "constraint tan circles on circle and pnt",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"tolerance": 1e-7,
"radius": 2
},
"inputs": {
"circle": {
"connections": [
{
"node": "d4e5f6g7h8i9j0k1",
"output": "result",
"data": {}
}
]
},
"point": {
"connections": [
{
"node": "e5f6g7h8i9j0k1l2",
"output": "result",
"data": {}
}
]
}
},
"position": [
1443.2109876543211,
410.9876543210988
]
}
}
}

Getting the Best Results

Working with Precision

The default precision settings work well for most projects. If you're working with very large structures like buildings, you might want to be a bit less strict with the precision. For tiny, detailed mechanical parts, you might need more precision. Think of it like adjusting the zoom level on your calculations.

Choosing Which Solutions to Keep

Many constraint operations find multiple valid solutions. You can ask for all of them to see your options, or specify that you only want the first or second solution if you know which arrangement you prefer. This is especially helpful when you're building parametric models where consistency matters.

Understanding Circle Splitting

Some operations can optionally split your input circles at the points where the tangent lines touch them. This creates separate circle segments that you can use for other operations. Most of the time you won't need this feature, but it's there when you do.

Sizing Tangent Circles

When creating tangent circles, start with smaller sizes to understand how the geometry behaves. You can always increase the radius once you see how the circles position themselves. Very large circles might not have valid tangent solutions depending on your input geometry.

Real-World Applications

These constraint operations solve problems that come up frequently in design work. Architects use them for creating smooth transitions in floor plans. Mechanical engineers use them for designing gear systems and smooth mechanical linkages. Even in artistic applications, they help create flowing, mathematically precise curves and connections.

Performance Tips

Constraint calculations can take some time with complex geometry. It's a good idea to test your setup with simple shapes first, then apply the same approach to your full model. This helps you catch any setup issues early and ensures your final results will be what you expect.

Building Complete Workflows

Think of edge constraints as one tool in a larger toolkit. They excel at solving specific geometric relationship problems, and they integrate seamlessly with other modeling operations to help you build exactly what you envision. The mathematical precision they provide becomes the foundation for reliable, parametric design workflows in BitByBit.