View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.geometry.io.euclidean.threed.stl;
18  
19  import java.nio.ByteOrder;
20  import java.nio.charset.Charset;
21  /*
22   * Licensed to the Apache Software Foundation (ASF) under one or more
23   * contributor license agreements.  See the NOTICE file distributed with
24   * this work for additional information regarding copyright ownership.
25   * The ASF licenses this file to You under the Apache License, Version 2.0
26   * (the "License"); you may not use this file except in compliance with
27   * the License.  You may obtain a copy of the License at
28   *
29   *      http://www.apache.org/licenses/LICENSE-2.0
30   *
31   * Unless required by applicable law or agreed to in writing, software
32   * distributed under the License is distributed on an "AS IS" BASIS,
33   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34   * See the License for the specific language governing permissions and
35   * limitations under the License.
36   */
37  import java.nio.charset.StandardCharsets;
38  
39  /** Class containing constants for the STL file format.
40   */
41  final class StlConstants {
42  
43      /** Default STL charset. */
44      static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
45  
46      /** Keyword indicating the start of a solid. This is also the keyword used to indicate the
47       * start of a text (ASCII) STL file.
48       */
49      static final String SOLID_START_KEYWORD = "solid";
50  
51      /** Keyword used to indicate the end of a solid definition. */
52      static final String SOLID_END_KEYWORD = "endsolid";
53  
54      /** Keyword used to indicate the start of a facet. */
55      static final String FACET_START_KEYWORD = "facet";
56  
57      /** Keyword used to indicate the end of a facet. */
58      static final String FACET_END_KEYWORD = "endfacet";
59  
60      /** Keyword used to introduce a facet normal. */
61      static final String NORMAL_KEYWORD = "normal";
62  
63      /** Keyword used when describing the outer vertex loop of a facet. */
64      static final String OUTER_KEYWORD = "outer";
65  
66      /** Keyword used to indicate the start of a vertex loop. */
67      static final String LOOP_START_KEYWORD = "loop";
68  
69      /** Keyword used to indicate the end of a vertex loop. */
70      static final String LOOP_END_KEYWORD = "endloop";
71  
72      /** Keyword used to indicate a vertex definition. */
73      static final String VERTEX_KEYWORD = "vertex";
74  
75      /** Number of bytes in the binary format header. */
76      static final int BINARY_HEADER_BYTES = 80;
77  
78      /** Number of bytes for each triangle in the binary format. */
79      static final int BINARY_TRIANGLE_BYTES = 50;
80  
81      /** Byte order for binary data. */
82      static final ByteOrder BINARY_BYTE_ORDER = ByteOrder.LITTLE_ENDIAN;
83  
84      /** Utility class; no instantiation. */
85      private StlConstants() {}
86  }