use of gaiasky.scenegraph.particle.IParticleRecord in project gaiasky by langurmonkey.
the class ParticleGroup method getCandidateViewAngleApparent.
@Override
public double getCandidateViewAngleApparent() {
if (candidateFocusIndex >= 0) {
IParticleRecord candidate = pointData.get(candidateFocusIndex);
Vector3d aux = candidate.pos(D31.get());
ICamera camera = GaiaSky.instance.getICamera();
return (float) ((size * .5e2f / aux.sub(camera.getPos()).len()) / camera.getFovFactor());
} else {
return -1;
}
}
use of gaiasky.scenegraph.particle.IParticleRecord in project gaiasky by langurmonkey.
the class ParticleGroup method generateIndex.
/**
* Generates the index (maps name to array index)
* and computes the geometric center of this group
*
* @param pointData The data
*
* @return An map{string,int} mapping names to indices
*/
public Map<String, Integer> generateIndex(List<IParticleRecord> pointData) {
Map<String, Integer> index = new HashMap<>((int) (pointData.size() * 1.25));
int n = pointData.size();
for (int i = 0; i < n; i++) {
IParticleRecord pb = pointData.get(i);
if (pb.names() != null) {
final int idx = i;
Arrays.stream(pb.names()).forEach(name -> index.put(name.toLowerCase(), idx));
}
}
return index;
}
use of gaiasky.scenegraph.particle.IParticleRecord in project gaiasky by langurmonkey.
the class SceneGraph method removeFromHipMap.
private void removeFromHipMap(SceneGraphNode node) {
if (node instanceof AbstractOctreeWrapper) {
AbstractOctreeWrapper aow = (AbstractOctreeWrapper) node;
Set<SceneGraphNode> set = aow.parenthood.keySet();
for (SceneGraphNode ape : set) removeFromHipMap(ape);
} else {
synchronized (hipMap) {
if (node instanceof CelestialBody) {
CelestialBody s = (CelestialBody) node;
if (s instanceof Star && ((Star) s).hip >= 0) {
hipMap.remove(((Star) s).hip);
}
} else if (node instanceof StarGroup) {
StarGroup sg = (StarGroup) node;
List<IParticleRecord> arr = sg.data();
if (arr != null) {
for (IParticleRecord pb : arr) {
if (pb != null && pb.hip() >= 0)
hipMap.remove(pb.hip());
}
}
}
}
}
}
use of gaiasky.scenegraph.particle.IParticleRecord in project gaiasky by langurmonkey.
the class StarGroup method getCandidateViewAngleApparent.
@Override
public double getCandidateViewAngleApparent() {
if (candidateFocusIndex >= 0) {
IParticleRecord candidate = pointData.get(candidateFocusIndex);
Vector3d aux = candidate.pos(D31.get());
ICamera camera = GaiaSky.instance.getICamera();
double va = (float) ((candidate.radius() / aux.sub(camera.getPos()).len()) / camera.getFovFactor());
return va * Settings.settings.scene.star.brightness;
} else {
return -1;
}
}
use of gaiasky.scenegraph.particle.IParticleRecord in project gaiasky by langurmonkey.
the class StarGroup method updateFocus.
/**
* Updates the parameters of the focus, if the focus is active in this group
*
* @param camera The current camera
*/
public void updateFocus(ICamera camera) {
IParticleRecord focus = pointData.get(focusIndex);
Vector3d aux = this.fetchPosition(focus, cPosD, D31.get(), currDeltaYears);
this.focusPosition.set(aux).add(camera.getPos());
this.focusDistToCamera = aux.len();
this.focusSize = getFocusSize();
this.focusViewAngle = (float) ((getRadius() / this.focusDistToCamera) / camera.getFovFactor());
this.focusViewAngleApparent = this.focusViewAngle * Settings.settings.scene.star.brightness;
}
Aggregations