Skip to content

Commit

Permalink
Merge branch 'release/2.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
naavis committed Jul 13, 2019
2 parents 2b5fcef + 5dd0a17 commit c80ddb0
Show file tree
Hide file tree
Showing 26 changed files with 377 additions and 107 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,23 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 2.3.0 - 2019-07-13

### Added
- Added menu bar with option to save simulation result as image
- Added slider for setting the probability of double scattering

### Changed
- Replaced Add Population and Remove Population texts with icons

## 2.2.0 - 2019-07-09

### Added
- Created an application icon for HaloRay
- Added possibility to add preset crystal populations

### Changed
- Disabled "Add population" button when there is only one population in simulation
- Disabled "Remove population" button when there is only one population in simulation
- Added multiple crystal populations by default

## 2.1.1 - 2019-07-08
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# HaloRay
# HaloRay ![](images/hexagon_small.png)
[![Build status](https://ci.appveyor.com/api/projects/status/5k9laekby84x2ex1/branch/develop?svg=true)](https://ci.appveyor.com/project/naavis/haloray/branch/develop)

HaloRay simulates the reflection and refraction of sun light inside hexagonal
Expand Down Expand Up @@ -37,9 +37,14 @@ Here are some general settings for the whole simulation.
- **Rays per frame:** Number of rays traced through individual crystals per
rendered frame
- If the user interface slows down a lot during rendering, lower this value
- On an NVIDIA GeForce GTX 1070 a good value seems to be 500 000 - 1 000 000
- On an NVIDIA GeForce GTX 1070 a good value seems to be around 500 000
- The maximum value for this parameter may be limited by your GPU
- **Maximum frames:** Simulation stops after rendering this many frames
- **Double scattering:** Probability of a single light ray to scatter from two
different ice crystals
- Note that this slows down the simulation significantly!
- A value of 0.0 means no rays are scattered twice, and 1.0 means all rays
are scattered twice

### Crystal settings

Expand Down Expand Up @@ -139,6 +144,7 @@ resulting executable:
- Qt5Core.dll
- Qt5Widgets.dll
- Qt5Gui.dll
- Qt5Svg.dll

You can also do this automatically with the
[windeployqt](https://doc.qt.io/qt-5/windows-deployment.html) tool, which is
Expand Down
3 changes: 1 addition & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
version: '2.2.0-{build}'
version: '2.3.0-{build}'
branches:
only:
- master
- develop
- /release\/.+/
image: Visual Studio 2017
clone_depth: 1
environment:
Expand Down
Binary file added images/hexagon_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 7 additions & 8 deletions src/gui/addCrystalPopulationButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
AddCrystalPopulationButton::AddCrystalPopulationButton(QWidget *parent)
: QToolButton(parent)
{
setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Expanding);

mMenu = new QMenu(this);

mAddRandom = new QAction("Add random", this);
mAddPlate = new QAction("Add plate", this);
mAddColumn = new QAction("Add column", this);
mAddParry = new QAction("Add Parry", this);
mAddLowitz = new QAction("Add Lowitz", this);
mAddRandom = new QAction(tr("Add random"), this);
mAddPlate = new QAction(tr("Add plate"), this);
mAddColumn = new QAction(tr("Add column"), this);
mAddParry = new QAction(tr("Add Parry"), this);
mAddLowitz = new QAction(tr("Add Lowitz"), this);

mMenu->addActions({mAddRandom,
mAddPlate,
Expand All @@ -20,7 +18,8 @@ AddCrystalPopulationButton::AddCrystalPopulationButton(QWidget *parent)
mAddLowitz});

setPopupMode(QToolButton::ToolButtonPopupMode::MenuButtonPopup);
setText("Add population");
setIcon(QIcon::fromTheme("list-add"));

setMenu(mMenu);

connect(this, &AddCrystalPopulationButton::clicked, [this]() { emit addPopulation(HaloSim::CrystalPopulationPreset::Random); });
Expand Down
55 changes: 24 additions & 31 deletions src/gui/crystalSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "../simulation/crystalPopulation.h"

CrystalSettingsWidget::CrystalSettingsWidget(std::shared_ptr<HaloSim::CrystalPopulationRepository> crystalRepository, QWidget *parent)
: QGroupBox("Crystal settings", parent),
: QGroupBox("Crystal population settings", parent),
mModel(new CrystalModel(crystalRepository)),
mNextPopulationId(1)
{
Expand Down Expand Up @@ -66,7 +66,7 @@ CrystalSettingsWidget::CrystalSettingsWidget(std::shared_ptr<HaloSim::CrystalPop
updateRemovePopulationButtonState();
});

connect(mRemovePopulationButton, &QPushButton::clicked, [this]() {
connect(mRemovePopulationButton, &QToolButton::clicked, [this]() {
int index = mMapper->currentIndex();
if (index == 0)
mMapper->toNext();
Expand Down Expand Up @@ -112,73 +112,66 @@ void CrystalSettingsWidget::setupUi()
mPopulationComboBox->setDuplicatesEnabled(true);

mAddPopulationButton = new AddCrystalPopulationButton();
mAddPopulationButton->setMinimumHeight(30);
mAddPopulationButton->setIconSize(QSize(24, 24));

mRemovePopulationButton = new QPushButton("Remove population");
mRemovePopulationButton->setMinimumHeight(30);
mRemovePopulationButton->setStyleSheet("padding: 10px;");
mRemovePopulationButton = new QToolButton();
mRemovePopulationButton->setIcon(QIcon::fromTheme("list-remove"));
mRemovePopulationButton->setIconSize(QSize(24, 24));

mCaRatioSlider = new SliderSpinBox(0.0, 15.0);

mCaRatioStdSlider = new SliderSpinBox(0.0, 10.0);

mTiltDistributionComboBox = new QComboBox();
mTiltDistributionComboBox->addItems({"Uniform", "Gaussian"});
mTiltDistributionComboBox->addItems({tr("Uniform"), tr("Gaussian")});

mTiltAverageLabel = new QLabel("Average");
mTiltAverageSlider = createAngleSlider(0.0, 180.0);
mTiltAverageLabel = new QLabel(tr("Average"));
mTiltAverageSlider = SliderSpinBox::createAngleSlider(0.0, 180.0);

mTiltStdLabel = new QLabel("Standard deviation");
mTiltStdSlider = createAngleSlider(0.0, 360.0);
mTiltStdLabel = new QLabel(tr("Standard deviation"));
mTiltStdSlider = SliderSpinBox::createAngleSlider(0.0, 360.0);

mRotationDistributionComboBox = new QComboBox();
mRotationDistributionComboBox->addItems({"Uniform", "Gaussian"});
mRotationDistributionComboBox->addItems({tr("Uniform"), tr("Gaussian")});

mRotationAverageLabel = new QLabel("Average");
mRotationAverageSlider = createAngleSlider(0.0, 180.0);
mRotationAverageLabel = new QLabel(tr("Average"));
mRotationAverageSlider = SliderSpinBox::createAngleSlider(0.0, 180.0);

mRotationStdLabel = new QLabel("Standard deviation");
mRotationStdSlider = createAngleSlider(0.0, 360.0);
mRotationStdLabel = new QLabel(tr("Standard deviation"));
mRotationStdSlider = SliderSpinBox::createAngleSlider(0.0, 360.0);

mWeightSpinBox = new QSpinBox();
mWeightSpinBox->setMinimum(0);
mWeightSpinBox->setMaximum(10000);

auto mainLayout = new QFormLayout(this);
mainLayout->addRow("Crystal population", mPopulationComboBox);

auto populationButtonLayout = new QHBoxLayout();
populationButtonLayout->addWidget(mPopulationComboBox);
populationButtonLayout->addWidget(mAddPopulationButton);
populationButtonLayout->addWidget(mRemovePopulationButton);

mainLayout->addRow(populationButtonLayout);
mainLayout->addRow("Population weight", mWeightSpinBox);
mainLayout->addRow(tr("Population weight"), mWeightSpinBox);
mainLayout->addItem(new QSpacerItem(0, 10));
mainLayout->addRow("C/A ratio average", mCaRatioSlider);
mainLayout->addRow("C/A ratio std.", mCaRatioStdSlider);
mainLayout->addRow(tr("C/A ratio average"), mCaRatioSlider);
mainLayout->addRow(tr("C/A ratio std."), mCaRatioStdSlider);

auto tiltGroupBox = new QGroupBox("C-axis tilt");
auto tiltGroupBox = new QGroupBox(tr("C-axis tilt"));
auto tiltLayout = new QFormLayout(tiltGroupBox);
mainLayout->addRow(tiltGroupBox);
tiltLayout->addRow("Distribution", mTiltDistributionComboBox);
tiltLayout->addRow(tr("Distribution"), mTiltDistributionComboBox);
tiltLayout->addRow(mTiltAverageLabel, mTiltAverageSlider);
tiltLayout->addRow(mTiltStdLabel, mTiltStdSlider);

auto rotationGroupBox = new QGroupBox("Rotation around C-axis");
auto rotationGroupBox = new QGroupBox(tr("Rotation around C-axis"));
auto rotationLayout = new QFormLayout(rotationGroupBox);
mainLayout->addRow(rotationGroupBox);
rotationLayout->addRow("Distribution", mRotationDistributionComboBox);
rotationLayout->addRow(tr("Distribution"), mRotationDistributionComboBox);
rotationLayout->addRow(mRotationAverageLabel, mRotationAverageSlider);
rotationLayout->addRow(mRotationStdLabel, mRotationStdSlider);
}

SliderSpinBox *CrystalSettingsWidget::createAngleSlider(double min, double max)
{
auto slider = new SliderSpinBox(min, max);
slider->setSuffix("°");
return slider;
}

void CrystalSettingsWidget::setTiltVisibility(bool visible)
{
mTiltAverageSlider->setVisible(visible);
Expand Down
4 changes: 2 additions & 2 deletions src/gui/crystalSettingsWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <QGroupBox>
#include <QComboBox>
#include <QLabel>
#include <QPushButton>
#include <QToolButton>
#include <QSpinBox>
#include <QDataWidgetMapper>
#include "addCrystalPopulationButton.h"
Expand Down Expand Up @@ -31,7 +31,7 @@ class CrystalSettingsWidget : public QGroupBox
void setRotationVisibility(bool);

AddCrystalPopulationButton *mAddPopulationButton;
QPushButton *mRemovePopulationButton;
QToolButton *mRemovePopulationButton;

SliderSpinBox *mCaRatioSlider;
SliderSpinBox *mCaRatioStdSlider;
Expand Down
32 changes: 19 additions & 13 deletions src/gui/generalSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,43 @@ GeneralSettingsWidget::GeneralSettingsWidget(QWidget *parent)
setupUi();

connect(mSunAltitudeSlider, &SliderSpinBox::valueChanged, [this]() {
lightSourceChanged(stateToLightSource());
emit lightSourceChanged(stateToLightSource());
});

connect(mSunDiameterSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this]() {
lightSourceChanged(stateToLightSource());
emit lightSourceChanged(stateToLightSource());
});

connect(mRaysPerFrameSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) {
numRaysChanged((unsigned int)value);
emit numRaysChanged((unsigned int)value);
});

connect(mMaximumFramesSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) {
maximumNumberOfIterationsChanged((unsigned int)value);
emit maximumNumberOfIterationsChanged((unsigned int)value);
});

connect(mMultipleScattering, &SliderSpinBox::valueChanged, this, &GeneralSettingsWidget::multipleScatteringProbabilityChanged);
}

void GeneralSettingsWidget::setInitialValues(double sunDiameter,
double sunAltitude,
unsigned int raysPerFrame,
unsigned int maxNumFrames)
unsigned int maxNumFrames,
double multipleScatteringProbability)
{
mSunDiameterSpinBox->setValue(sunDiameter);
mSunAltitudeSlider->setValue(sunAltitude);
mRaysPerFrameSpinBox->setValue(raysPerFrame);
mMaximumFramesSpinBox->setValue(maxNumFrames);
mMultipleScattering->setValue(multipleScatteringProbability);
}

void GeneralSettingsWidget::setupUi()
{
setMaximumWidth(400);

mSunAltitudeSlider = new SliderSpinBox();
mSunAltitudeSlider->setSuffix("­°");
mSunAltitudeSlider->setMinimum(-90.0);
mSunAltitudeSlider->setMaximum(90.0);
mSunAltitudeSlider->setValue(0.0);
mSunAltitudeSlider = SliderSpinBox::createAngleSlider(-90.0, 90.0);

mSunDiameterSpinBox = new QDoubleSpinBox();
mSunDiameterSpinBox->setSuffix("­°");
Expand All @@ -65,11 +66,16 @@ void GeneralSettingsWidget::setupUi()
mMaximumFramesSpinBox->setValue(100000000);
mMaximumFramesSpinBox->setGroupSeparatorShown(true);

mMultipleScattering = new SliderSpinBox();
mMultipleScattering->setMinimum(0.0);
mMultipleScattering->setMaximum(1.0);

auto layout = new QFormLayout(this);
layout->addRow("Sun altitude", mSunAltitudeSlider);
layout->addRow("Sun diameter", mSunDiameterSpinBox);
layout->addRow("Rays per frame", mRaysPerFrameSpinBox);
layout->addRow("Maximum frames", mMaximumFramesSpinBox);
layout->addRow(tr("Sun altitude"), mSunAltitudeSlider);
layout->addRow(tr("Sun diameter"), mSunDiameterSpinBox);
layout->addRow(tr("Rays per frame"), mRaysPerFrameSpinBox);
layout->addRow(tr("Maximum frames"), mMaximumFramesSpinBox);
layout->addRow(tr("Double scattering"), mMultipleScattering);
}

HaloSim::LightSource GeneralSettingsWidget::stateToLightSource() const
Expand Down
5 changes: 4 additions & 1 deletion src/gui/generalSettingsWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ class GeneralSettingsWidget : public QGroupBox
void setInitialValues(double sunDiameter,
double sunAltitude,
unsigned int raysPerFrame,
unsigned int maxNumFrames);
unsigned int maxNumFrames,
double multipleScatteringProbability);

signals:
void lightSourceChanged(HaloSim::LightSource light);
void numRaysChanged(unsigned int rays);
void maximumNumberOfIterationsChanged(unsigned int iterations);
void multipleScatteringProbabilityChanged(double probability);

public slots:
void toggleMaxIterationsSpinBoxStatus();
Expand All @@ -33,4 +35,5 @@ public slots:
QDoubleSpinBox *mSunDiameterSpinBox;
QSpinBox *mRaysPerFrameSpinBox;
QSpinBox *mMaximumFramesSpinBox;
SliderSpinBox *mMultipleScattering;
};
Loading

0 comments on commit c80ddb0

Please sign in to comment.