blob: 7735e18f343252bf5d7ec01882b662a1bc6f7014 [file] [log] [blame]
/*******************************************************************************
* 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.addons.sensors.fov.impl;
import org.eclipse.apogy.addons.sensors.fov.ApogyAddonsSensorsFOVFactory;
import org.eclipse.apogy.addons.sensors.fov.ApogyAddonsSensorsFOVPackage;
import org.eclipse.apogy.addons.sensors.fov.DistanceRange;
import org.eclipse.apogy.common.emf.transaction.ApogyCommonTransactionFacade;
public class ConicalFieldOfViewCustomImpl extends ConicalFieldOfViewImpl {
@Override
public DistanceRange getRange() {
DistanceRange tmp = super.getRange();
if (tmp == null) {
tmp = ApogyAddonsSensorsFOVFactory.eINSTANCE.createDistanceRange();
ApogyCommonTransactionFacade.INSTANCE.basicSet(this,
ApogyAddonsSensorsFOVPackage.Literals.CONICAL_FIELD_OF_VIEW__RANGE, tmp, true);
}
return tmp;
}
@Override
public double getVolume() {
double largeConeVolume = (2.0 / 3.0) * Math.PI * Math.pow(getRange().getMaximumDistance(), 3.0)
* (1 - (Math.cos(this.getFieldOfViewAngle() / 2)));
double smallConeVolume = (2.0 / 3.0) * Math.PI * Math.pow(getRange().getMinimumDistance(), 3.0)
* (1 - (Math.cos(this.getFieldOfViewAngle() / 2)));
return largeConeVolume - smallConeVolume;
}
} // ConicalFieldOfViewImpl