Java tutorial
//package com.java2s; /* * Copyright 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. * * Last modified 2016-12-03 22:55:55 * */ import android.graphics.PointF; public class Main { private static int Cap_Axis_Distance = 15; private static int Cap_Head_Distance = 30; private static float XAxisPosLen_3D = 400; private static float XAxisNegLen_3D = 400; private static float YAxisPosLen_3D = 500; private static float YAxisNegLen_3D = 500; private static float ZAxisPosLen_3D = 300; private static float ZAxisNegLen_3D = 400; private static PointF XHead_3D, XTail_3D, YHead_3D, YTail_3D, ZHead_3D, ZTail_3D; private static PointF XCap1_3D, XCap2_3D, YCap1_3D, YCap2_3D, ZCap1_3D, ZCap2_3D; private static void init3DPoint() { XHead_3D = new PointF(+XAxisPosLen_3D, 0); XTail_3D = new PointF(-XAxisNegLen_3D, 0); XCap1_3D = new PointF(XAxisPosLen_3D - Cap_Head_Distance, +Cap_Axis_Distance); XCap2_3D = new PointF(XAxisPosLen_3D - Cap_Head_Distance, -Cap_Axis_Distance); YHead_3D = new PointF(0, -YAxisPosLen_3D); YTail_3D = new PointF(0, +YAxisNegLen_3D); YCap1_3D = new PointF(+Cap_Axis_Distance, -YAxisPosLen_3D + Cap_Head_Distance); YCap2_3D = new PointF(-Cap_Axis_Distance, -YAxisPosLen_3D + Cap_Head_Distance); float zl = convert_3D_to_2D(ZAxisPosLen_3D); float nzl = convert_3D_to_2D(ZAxisNegLen_3D); float CAD = convert_3D_to_2D(Cap_Axis_Distance); float CHD = convert_3D_to_2D(Cap_Head_Distance); ZHead_3D = new PointF(zl, -zl); ZTail_3D = new PointF(-nzl, nzl); ZCap1_3D = new PointF(ZHead_3D.x - CHD - CAD, ZHead_3D.y + CHD - CAD); ZCap2_3D = new PointF(ZHead_3D.x - CHD + CAD, ZHead_3D.y + CHD + CAD); } private static float convert_3D_to_2D(float l) { return l * 3 / 4; } }