StlConstants.java

  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. import java.nio.ByteOrder;
  19. import java.nio.charset.Charset;
  20. /*
  21.  * Licensed to the Apache Software Foundation (ASF) under one or more
  22.  * contributor license agreements.  See the NOTICE file distributed with
  23.  * this work for additional information regarding copyright ownership.
  24.  * The ASF licenses this file to You under the Apache License, Version 2.0
  25.  * (the "License"); you may not use this file except in compliance with
  26.  * the License.  You may obtain a copy of the License at
  27.  *
  28.  *      http://www.apache.org/licenses/LICENSE-2.0
  29.  *
  30.  * Unless required by applicable law or agreed to in writing, software
  31.  * distributed under the License is distributed on an "AS IS" BASIS,
  32.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  33.  * See the License for the specific language governing permissions and
  34.  * limitations under the License.
  35.  */
  36. import java.nio.charset.StandardCharsets;

  37. /** Class containing constants for the STL file format.
  38.  */
  39. final class StlConstants {

  40.     /** Default STL charset. */
  41.     static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;

  42.     /** Keyword indicating the start of a solid. This is also the keyword used to indicate the
  43.      * start of a text (ASCII) STL file.
  44.      */
  45.     static final String SOLID_START_KEYWORD = "solid";

  46.     /** Keyword used to indicate the end of a solid definition. */
  47.     static final String SOLID_END_KEYWORD = "endsolid";

  48.     /** Keyword used to indicate the start of a facet. */
  49.     static final String FACET_START_KEYWORD = "facet";

  50.     /** Keyword used to indicate the end of a facet. */
  51.     static final String FACET_END_KEYWORD = "endfacet";

  52.     /** Keyword used to introduce a facet normal. */
  53.     static final String NORMAL_KEYWORD = "normal";

  54.     /** Keyword used when describing the outer vertex loop of a facet. */
  55.     static final String OUTER_KEYWORD = "outer";

  56.     /** Keyword used to indicate the start of a vertex loop. */
  57.     static final String LOOP_START_KEYWORD = "loop";

  58.     /** Keyword used to indicate the end of a vertex loop. */
  59.     static final String LOOP_END_KEYWORD = "endloop";

  60.     /** Keyword used to indicate a vertex definition. */
  61.     static final String VERTEX_KEYWORD = "vertex";

  62.     /** Number of bytes in the binary format header. */
  63.     static final int BINARY_HEADER_BYTES = 80;

  64.     /** Number of bytes for each triangle in the binary format. */
  65.     static final int BINARY_TRIANGLE_BYTES = 50;

  66.     /** Byte order for binary data. */
  67.     static final ByteOrder BINARY_BYTE_ORDER = ByteOrder.LITTLE_ENDIAN;

  68.     /** Utility class; no instantiation. */
  69.     private StlConstants() {}
  70. }