Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * Copyright (c) 2016 GcsSloop
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * GitHub :  https://github.com/GcsSloop
 * Weibo  :  http://weibo,com/GcsSloop
 * Blog     :  http://www.gcssloop.com
 *
 * Last modify $2016-09-09 21:38:09
 */

import android.graphics.Point;

public class Main {
    private static int Cap_Axis_Distance = 15;
    private static int Cap_Head_Distance = 30;
    private static int XAxisPosLen_3D = 400;
    private static int XAxisNegLen_3D = 400;
    private static int YAxisPosLen_3D = 500;
    private static int YAxisNegLen_3D = 500;
    private static int ZAxisPosLen_3D = 300;
    private static int ZAxisNegLen_3D = 400;
    private static Point XHead_3D, XTail_3D, YHead_3D, YTail_3D, ZHead_3D, ZTail_3D;
    private static Point XCap1_3D, XCap2_3D, YCap1_3D, YCap2_3D, ZCap1_3D, ZCap2_3D;

    private static void init3DPoint() {

        XHead_3D = new Point(+XAxisPosLen_3D, 0);
        XTail_3D = new Point(-XAxisNegLen_3D, 0);
        XCap1_3D = new Point(XAxisPosLen_3D - Cap_Head_Distance, +Cap_Axis_Distance);
        XCap2_3D = new Point(XAxisPosLen_3D - Cap_Head_Distance, -Cap_Axis_Distance);

        YHead_3D = new Point(0, -YAxisPosLen_3D);
        YTail_3D = new Point(0, +YAxisNegLen_3D);
        YCap1_3D = new Point(+Cap_Axis_Distance, -YAxisPosLen_3D + Cap_Head_Distance);
        YCap2_3D = new Point(-Cap_Axis_Distance, -YAxisPosLen_3D + Cap_Head_Distance);

        int zl = convert_3D_to_2D(ZAxisPosLen_3D);
        int nzl = convert_3D_to_2D(ZAxisNegLen_3D);
        int CAD = convert_3D_to_2D(Cap_Axis_Distance);
        int CHD = convert_3D_to_2D(Cap_Head_Distance);
        ZHead_3D = new Point(zl, -zl);
        ZTail_3D = new Point(-nzl, nzl);
        ZCap1_3D = new Point(ZHead_3D.x - CHD - CAD, ZHead_3D.y + CHD - CAD);
        ZCap2_3D = new Point(ZHead_3D.x - CHD + CAD, ZHead_3D.y + CHD + CAD);
    }

    private static int convert_3D_to_2D(int l) {
        return l * 3 / 4;
    }
}