Project

General

Profile

Download (4.26 KB) Statistics
| Branch: | Revision:

distorted-objectlib / src / main / java / org / distorted / objectlib / helpers / ObjectFaceShape.java @ 3ee1d662

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2021 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.objectlib.helpers;
21

    
22
import org.distorted.objectlib.main.ObjectControl;
23

    
24
///////////////////////////////////////////////////////////////////////////////////////////////////
25

    
26
public class ObjectFaceShape
27
  {
28
  private final int[] mBandIndices;
29
  private final float[][] mCorners;
30
  private final int[] mCornerIndices;
31
  private final float[][] mCenters;
32
  private final int[] mCenterIndices;
33
  private final float[] mConvexityCenter;
34

    
35
  private float[][] mBands;
36

    
37
///////////////////////////////////////////////////////////////////////////////////////////////////
38

    
39
  public ObjectFaceShape(float[][] bands, int[] bandIndices, float[][] corners, int[] cornIndices,
40
                         float[][] centers, int[] centIndices, float[] convexityCenter)
41
    {
42
    mBands           = bands;
43
    mBandIndices     = bandIndices;
44
    mCorners         = corners;
45
    mCornerIndices   = cornIndices;
46
    mCenters         = centers;
47
    mCenterIndices   = centIndices;
48
    mConvexityCenter = convexityCenter;
49

    
50
    if( ObjectControl.isInIconMode() )
51
      {
52
      int len = bands.length;
53
      mBands = new float[len][];
54

    
55
      for(int i=0; i<len; i++)
56
        {
57
        int l = bands[i].length;
58
        mBands[i] = new float[l];
59
        mBands[i][0] = 0.01f;
60
        if (l>=1) System.arraycopy(bands[i], 1, mBands[i], 1, l-1);
61
        }
62
      }
63
    }
64

    
65
///////////////////////////////////////////////////////////////////////////////////////////////////
66

    
67
  public float[][] getBands()
68
    {
69
    return mBands;
70
    }
71

    
72
///////////////////////////////////////////////////////////////////////////////////////////////////
73

    
74
  public int[] getBandIndices()
75
    {
76
    return mBandIndices;
77
    }
78

    
79
///////////////////////////////////////////////////////////////////////////////////////////////////
80

    
81
  public float[][] getCorners()
82
    {
83
    return mCorners;
84
    }
85

    
86
///////////////////////////////////////////////////////////////////////////////////////////////////
87

    
88
  public int[] getCornerIndices()
89
    {
90
    return mCornerIndices;
91
    }
92

    
93
///////////////////////////////////////////////////////////////////////////////////////////////////
94

    
95
  public float[][] getCenters()
96
    {
97
    return mCenters;
98
    }
99

    
100
///////////////////////////////////////////////////////////////////////////////////////////////////
101

    
102
  public int[] getCenterIndices()
103
    {
104
    return mCenterIndices;
105
    }
106

    
107
///////////////////////////////////////////////////////////////////////////////////////////////////
108

    
109
  public float[] getConvexityCenter()
110
    {
111
    return mConvexityCenter;
112
    }
113
  }
(5-5/11)