| /******************************************************************************* |
| * Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Pierre Allard, |
| * Regent L'Archeveque - initial API and implementation |
| * |
| * SPDX-License-Identifier: EPL-1.0 |
| * |
| *******************************************************************************/ |
| package org.eclipse.apogy.common.geometry.data3d.impl; |
| |
| import javax.vecmath.Vector3d; |
| |
| import org.eclipse.apogy.common.geometry.data3d.CartesianPositionCoordinates; |
| import org.eclipse.apogy.common.geometry.data3d.Geometry3DUtilities; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| public class CartesianPolygonCustomImpl extends CartesianPolygonImpl { |
| public double getSurface() { |
| return Geometry3DUtilities.getPolygonSurface(this.getVertices()); |
| } |
| |
| public Vector3d getNormal() { |
| return Geometry3DUtilities.getPolygonNormal(this.getVertices()); |
| } |
| |
| public CartesianPositionCoordinates getCentroid() { |
| CartesianPositionCoordinates centroid = basicGetCentroid(); |
| return centroid != null && centroid.eIsProxy() |
| |
| ? (CartesianPositionCoordinates) eResolveProxy((InternalEObject) centroid) |
| : centroid; |
| } |
| |
| public CartesianPositionCoordinates basicGetCentroid() { |
| return Geometry3DUtilities.getCentroid(this.getVertices()); |
| } |
| |
| } // CartesianPolygonImpl |