Skip to content
Snippets Groups Projects
Commit 1af17c45 authored by Luc Maisonobe's avatar Luc Maisonobe
Browse files

Added sequences of transforms for lines-of-sight.

parent fe25cef2
No related branches found
No related tags found
No related merge requests found
/* Copyright 2013-2014 CS Systèmes d'Information
* Licensed to CS Systèmes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.orekit.rugged.los;
import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.orekit.time.AbsoluteDate;
/** {@link LOSTransform LOS transform} based on a fixed rotation.
* @author Luc Maisonobe
* @see LOSBuilder
*/
public class FixedRotation implements LOSTransform {
/** Underlying rotation. */
final Rotation rotation;
/** Simple constructor.
* @param rotation rotation to apply
*/
public FixedRotation(final Rotation rotation) {
this.rotation = rotation;
}
/** {@inheritDoc} */
@Override
public Vector3D transformLOS(int i, Vector3D los, AbsoluteDate date) {
return rotation.applyTo(los);
}
}
\ No newline at end of file
...@@ -20,6 +20,7 @@ import java.util.ArrayList; ...@@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.orekit.time.AbsoluteDate;
/** Builder for lines-of-sight list. /** Builder for lines-of-sight list.
* <p> * <p>
...@@ -37,22 +38,75 @@ public class LOSBuilder { ...@@ -37,22 +38,75 @@ public class LOSBuilder {
/** Raw fixed ine-of-sights. */ /** Raw fixed ine-of-sights. */
public final List<Vector3D> rawLOS; public final List<Vector3D> rawLOS;
/** Transforms to be applied. */
private final List<LOSTransform> transforms;
/** Create builder. /** Create builder.
* @param rawLOS raw fixed lines-of-sight * @param rawLOS raw fixed lines-of-sight
*/ */
public LOSBuilder(final List<Vector3D> rawLOS) { public LOSBuilder(final List<Vector3D> rawLOS) {
this.rawLOS = rawLOS; this.rawLOS = rawLOS;
this.transforms = new ArrayList<LOSTransform>();
}
/** Add a transform to be applied after the already registered transforms.
* @param transform transform to be applied to the lines-of-sight
*/
public void addTransform(final LOSTransform transform) {
transforms.add(transform);
} }
/** Build a list of transformed lines-of-sight. /** Build a list of transformed lines-of-sight.
* @return list of transformed lines of sight * @return list of transformed lines of sight
*/ */
public List<TimeDependentLOS> build() { public List<TimeDependentLOS> build() {
final List<TimeDependentLOS> los = new ArrayList<TimeDependentLOS>(rawLOS.size());
for (final Vector3D raw : rawLOS) { // copy the current transforms set, to ensure immutability
los.add(new FixedLOS(raw)); // of the built list, in case addTransform is called again after build
final List<LOSTransform> copy = new ArrayList<LOSTransform>(transforms);
final List<TimeDependentLOS> transformed = new ArrayList<TimeDependentLOS>(rawLOS.size());
for (int i = 0; i < rawLOS.size(); ++i) {
transformed.add(new TransformsSequenceLOS(i, rawLOS.get(i), copy));
}
return transformed;
}
/** Implement time-dependent LOS by applying all registered transforms. */
private static class TransformsSequenceLOS implements TimeDependentLOS {
/** LOS index. */
private final int index;
/** Raw direction. */
private final Vector3D raw;
/** Transforms to be applied. */
private final List<LOSTransform> transforms;
/** Simple constructor.
* @param index los index
* @param raw raw direction
* @param transforms transforms to apply
*/
public TransformsSequenceLOS(final int index, final Vector3D raw, final List<LOSTransform> transforms) {
this.index = index;
this.raw = raw;
this.transforms = transforms;
}
/** {@inheritDoc} */
@Override
public Vector3D getLOS(final AbsoluteDate date) {
Vector3D los = raw;
for (final LOSTransform transform : transforms) {
los = transform.transformLOS(index, los, date);
}
return los.normalize();
} }
return los;
} }
} }
/* Copyright 2013-2014 CS Systèmes d'Information
* Licensed to CS Systèmes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.orekit.rugged.los;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.orekit.time.AbsoluteDate;
/** Interface for lines-of-sight tranforms.
* @author Luc Maisonobe
* @see LOSBuilder
*/
interface LOSTransform {
/** Transform a line-of-sight.
* @param i los pixel index
* @param los line-of-sight to transform
* @param date current date
* @return transformed line-of-sight
*/
Vector3D transformLOS(int i, Vector3D los, AbsoluteDate date);
}
\ No newline at end of file
/* Copyright 2013-2014 CS Systèmes d'Information
* Licensed to CS Systèmes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.orekit.rugged.los;
import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.orekit.time.AbsoluteDate;
/** {@link LOSTransform LOS transform} based on a rotation with polynomial angle.
* @author Luc Maisonobe
* @see LOSBuilder
*/
public class PolynomialRotation implements LOSTransform {
/** Rotation axis. */
final Vector3D axis;
/** Rotation angle polynomial. */
final PolynomialFunction angle;
/** Reference date for polynomial evaluation. */
final AbsoluteDate referenceDate;
/** Simple constructor.
* @param axis rotation axis
* @param angle rotation angle as a polynomial in t, where t
* is the duration in seconds between evaluation date and reference date
* @param referenceDate reference date for the polynomial angle
*/
public PolynomialRotation(final Vector3D axis,
final PolynomialFunction angle,
final AbsoluteDate referenceDate) {
this.axis = axis;
this.angle = angle;
this.referenceDate = referenceDate;
}
/** {@inheritDoc} */
@Override
public Vector3D transformLOS(int i, Vector3D los, AbsoluteDate date) {
return new Rotation(axis, angle.value(date.durationFrom(referenceDate))).applyTo(los);
}
}
\ No newline at end of file
...@@ -27,7 +27,7 @@ import org.orekit.time.AbsoluteDate; ...@@ -27,7 +27,7 @@ import org.orekit.time.AbsoluteDate;
public interface TimeDependentLOS { public interface TimeDependentLOS {
/** Get the line of sight for a given date. /** Get the line of sight for a given date.
* @param date date * @param date date
* @return line of sight * @return line of sight
*/ */
Vector3D getLOS(AbsoluteDate date); Vector3D getLOS(AbsoluteDate date);
......
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
<body> <body>
<release version="1.0" date="TBD" <release version="1.0" date="TBD"
description="TBD"> description="TBD">
<action dev="luc" type="add" >
Added sequences of transforms for lines-of-sight.
</action>
<action dev="luc" type="add" > <action dev="luc" type="add" >
Added a builder for line-of-sight lists. Added a builder for line-of-sight lists.
</action> </action>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment