This repository was archived by the owner on Dec 27, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +92
-5
lines changed
desktop/graph3d/com/support/constraintlayout/extlib/graph3d Expand file tree Collapse file tree 7 files changed +92
-5
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (C) 2023 The Android Open Source Project
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
1
16
package com .support .constraintlayout .extlib .graph3d ;
2
17
3
18
import com .support .constraintlayout .extlib .graph3d .objects .AxisBox ;
9
24
import java .awt .image .BufferedImage ;
10
25
import java .awt .image .DataBufferInt ;
11
26
12
-
27
+ /**
28
+ * The JPanel that draws the Scene and handles mouse input
29
+ */
13
30
public class Graph3dPanel extends JPanel {
14
31
15
32
Scene3D mScene3D = new Scene3D ();
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (C) 2023 The Android Open Source Project
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
1
17
package com .support .constraintlayout .extlib .graph3d ;
2
18
3
19
import javax .swing .*;
4
20
21
+ /**
22
+ * Simple driver for the Graph3dPanel
23
+ */
5
24
public class Main {
6
25
public static void main (String [] args ) {
7
26
JFrame frame = new JFrame ("3d Plot" );
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (C) 2020 The Android Open Source Project
2
+ * Copyright (C) 2023 The Android Open Source Project
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
15
15
*/
16
16
package com .support .constraintlayout .extlib .graph3d ;
17
17
18
-
19
18
import java .text .DecimalFormat ;
20
19
import java .util .Arrays ;
21
20
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (C) 2023 The Android Open Source Project
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
1
17
package com .support .constraintlayout .extlib .graph3d ;
2
18
3
19
/**
4
- * This represents 3d Object in this system
20
+ * This represents 3d Object in this system.
5
21
*/
6
22
public class Object3D {
7
23
protected float [] vert ;
Original file line number Diff line number Diff line change 20
20
import java .util .Arrays ;
21
21
22
22
/**
23
- * This renders a 3 Dimentional surface of a function .
23
+ * This renders 3Dimensional Objects .
24
24
*/
25
25
public class Scene3D {
26
26
private static final String TAG = "SurfaceGen" ;
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (C) 2023 The Android Open Source Project
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
1
16
package com .support .constraintlayout .extlib .graph3d .objects ;
2
17
3
18
import com .support .constraintlayout .extlib .graph3d .Object3D ;
4
19
import com .support .constraintlayout .extlib .graph3d .Scene3D ;
5
20
21
+ /**
22
+ * Draws box along the axis
23
+ */
6
24
public class AxisBox extends Object3D {
7
25
int color = 0xFFFF3233 ;
8
26
public AxisBox () {
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (C) 2023 The Android Open Source Project
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
1
16
package com .support .constraintlayout .extlib .graph3d .objects ;
2
17
3
18
import com .support .constraintlayout .extlib .graph3d .Object3D ;
4
19
20
+ /**
21
+ * Plots a surface based on Z = f(X,Y)
22
+ */
5
23
public class Surface3D extends Object3D {
6
24
final int SIZE = 100 ; // the number of point on the side total points = SIZE*SIZE
7
25
private Function mFunction ;
You can’t perform that action at this time.
0 commit comments