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+ */
116package com .support .constraintlayout .extlib .graph3d ;
217
318import com .support .constraintlayout .extlib .graph3d .objects .AxisBox ;
924import java .awt .image .BufferedImage ;
1025import java .awt .image .DataBufferInt ;
1126
12-
27+ /**
28+ * The JPanel that draws the Scene and handles mouse input
29+ */
1330public class Graph3dPanel extends JPanel {
1431
1532 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+
117package com .support .constraintlayout .extlib .graph3d ;
218
319import javax .swing .*;
420
21+ /**
22+ * Simple driver for the Graph3dPanel
23+ */
524public class Main {
625 public static void main (String [] args ) {
726 JFrame frame = new JFrame ("3d Plot" );
Original file line number Diff line number Diff line change 11/*
2- * Copyright (C) 2020 The Android Open Source Project
2+ * Copyright (C) 2023 The Android Open Source Project
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
1515 */
1616package com .support .constraintlayout .extlib .graph3d ;
1717
18-
1918import java .text .DecimalFormat ;
2019import java .util .Arrays ;
2120
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+
117package com .support .constraintlayout .extlib .graph3d ;
218
319/**
4- * This represents 3d Object in this system
20+ * This represents 3d Object in this system.
521 */
622public class Object3D {
723 protected float [] vert ;
Original file line number Diff line number Diff line change 2020import java .util .Arrays ;
2121
2222/**
23- * This renders a 3 Dimentional surface of a function .
23+ * This renders 3Dimensional Objects .
2424 */
2525public class Scene3D {
2626 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+ */
116package com .support .constraintlayout .extlib .graph3d .objects ;
217
318import com .support .constraintlayout .extlib .graph3d .Object3D ;
419import com .support .constraintlayout .extlib .graph3d .Scene3D ;
520
21+ /**
22+ * Draws box along the axis
23+ */
624public class AxisBox extends Object3D {
725 int color = 0xFFFF3233 ;
826 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+ */
116package com .support .constraintlayout .extlib .graph3d .objects ;
217
318import com .support .constraintlayout .extlib .graph3d .Object3D ;
419
20+ /**
21+ * Plots a surface based on Z = f(X,Y)
22+ */
523public class Surface3D extends Object3D {
624 final int SIZE = 100 ; // the number of point on the side total points = SIZE*SIZE
725 private Function mFunction ;
You can’t perform that action at this time.
0 commit comments