File: plane3d.html

package info (click to toggle)
jsxgraph 1.10.1%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 24,804 kB
  • sloc: javascript: 82,299; xml: 5,869; java: 1,072; php: 281; makefile: 184; python: 174; cpp: 76; sh: 12
file content (113 lines) | stat: -rw-r--r-- 2,982 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html>
<head>
    <title>Plane</title>
    <link rel="stylesheet" type="text/css" href="../distrib/jsxgraph.css" />
    <script type="text/javascript" src="../distrib/jsxgraphcore.js"></script>
</head>
<body>

<div id="jxgbox" class="jxgbox" style="width:800px; height:800px; float:left"></div>

<script type="text/javascript">
    let board = JXG.JSXGraph.initBoard(
        'jxgbox',
        {
            boundingbox: [-8, 8, 8,-8],
            axis: false,
            showcopyright: false,
            shownavigation: false
        }
    );
    let view = board.create(
        'view3d',
        [[-6, -3], [8, 8],
        [[0, 3], [0, 3], [0, 3]]],
        {
            xPlaneRear: {fillOpacity: 0.2, gradient: null},
            yPlaneRear: {fillOpacity: 0.2, gradient: null},
            zPlaneRear: {fillOpacity: 0.2, gradient: null},
            bank: {slider: {visible: true}}
        }
    );

    // Base point
    let basePt = view.create(
        'point3d',
        [1, 1, 1],
        {
            withLabel: false,
            size: 5,
            strokeWidth: 1,
            strokeColor: '#600030',
            fillColor: 'white',
            gradient: 'radial',
            gradientSecondColor: '#a00050',
            gradientFX: 0.7,
            gradientFY: 0.3,
            highlightStrokeColor: '#600030'
       }
    );
    
    // Handles
    let handle1 = view.create(
        'point3d',
        [0.5, 1.25, 1.25],
        {
            withLabel: false,
            size: 5,
            strokeWidth: 1,
            strokeColor: '#300060',
            fillColor: 'white',
            gradient: 'radial',
            gradientSecondColor: '#5000a0',
            gradientFX: 0.7,
            gradientFY: 0.3,
            highlightStrokeColor: '#300060'
       }
    );
    let handle2 = view.create(
        'point3d',
        [1.25, 0.5, 1.25],
        {
            withLabel: false,
            size: 5,
            strokeWidth: 1,
            strokeColor: '#300060',
            fillColor: 'white',
            gradient: 'radial',
            gradientSecondColor: '#5000a0',
            gradientFX: 0.7,
            gradientFY: 0.3,
            highlightStrokeColor: '#300060'
       }
    );
    let frameSeg1 = view.create('line3d', [basePt, handle1]);
    let frameSeg2 = view.create('line3d', [basePt, handle2]);
    let dir1 = [
        () => handle1.X() - basePt.X(),
        () => handle1.Y() - basePt.Y(),
        () => handle1.Z() - basePt.Z()
    ];
    let dir2 = [
        () => handle2.X() - basePt.X(),
        () => handle2.Y() - basePt.Y(),
        () => handle2.Z() - basePt.Z()
    ];
    
    // Plane
    let plane = view.create(
        'plane3d',
        [basePt, dir1, dir2],
        {
            strokeWidth: 1,
            strokeColor: '#00ff80',
            strokeOpacity: 0.5,
            fillColor: '#00ff80',
            fillOpacity: 0.1,
            gradient: null
        }
    );
</script>
</body>
</html>