Skip to content

Commit 92ad645

Browse files
authored
Update 696-math-intersect.markdown
1 parent 1ab8f0f commit 92ad645

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

_build/reference/696-math-intersect.markdown

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,36 @@ Calculates the intersection of the two line segments A-B and C-D. Returns: Rx,Ry
66

77
type = cross-type:
88

9-
- 0 No cross (R = external cross)
10-
- 1 One cross
11-
- 2 Parallel
12-
- 3 Parallel (many crosses)
13-
- 4 The cross is one of the line segments edges.
9+
- 0: No cross (R = external cross)
10+
- 1: One cross
11+
- 2: Parallel
12+
- 3: Parallel (many crosses)
13+
- 4: The cross is one of the line segments edges.
1414

15+
```
16+
'Line segment AB
17+
Ax = 50
18+
Ay = 50
19+
Bx = 100
20+
By = 100
1521
22+
'Line segment CD
23+
Cx = 100
24+
Cy = 50
25+
Dx = 50
26+
Dy = 100
27+
28+
type = 0
29+
Rx = 0
30+
Ry = 0
31+
32+
intersect Ax, Ay, Bx, By, Cx, Cy, Dx, Dy, type, Rx, Ry
33+
34+
print "Intersection at x = "; Rx; ", y = "; Ry
35+
36+
' Draw lines and a circle at the calculated crossing point
37+
line Ax, Ay, Bx, By color 5
38+
line Cx, Cy, Dx, Dy color 8
39+
circle Rx,Ry, 5 color 12
40+
41+
```

0 commit comments

Comments
 (0)