Commit 9ceca1e3 authored by Hurstel's avatar Hurstel
Browse files

Big commit (lol, sorry)

parent c672394c
......@@ -41,4 +41,5 @@ ADD_SUBDIRECTORY(surface_planeMapImageLoader)
ADD_SUBDIRECTORY(surface_2DCage)
ADD_SUBDIRECTORY(surface_3DCage)
#ADD_SUBDIRECTORY(surface_2DCage_testing)
<cages2D>
<settings unit="pct"/>
<cage infScale="12">
<v>-32 -16</v>
<v>0 -16</v>
<v>0 16</v>
<v>-32 16</v>
<v>-20 -25</v>
<v>0 -25</v>
<v>0 -15</v>
<v>-25 -15</v>
</cage>
<cage infScale="12">
<v>0 16</v>
<v>0 -16</v>
<v>32 -16</v>
<v>32 16</v>
<v>0 15</v>
<v>0 -15</v>
<v>20 -15</v>
<v>20 15</v>
</cage>
<phi2>
<link cageA="0" edgeA="1" cageB="1" edgeB="0" />
</phi2>
</cages2D>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AskSavePosDialog</class>
<widget class="QDialog" name="AskSavePosDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>157</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Postioning saving option:</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QRadioButton" name="absolute_radioButton">
<property name="text">
<string>Absolute</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="relative_radioButton">
<property name="text">
<string>Relative</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AskSavePosDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DisplayDialog</class>
<widget class="QDialog" name="DisplayDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>inf_vertices_size_factor:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="sizeFactor_spinBox">
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000100000000000</double>
</property>
<property name="maximum">
<double>9999.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="OK_pushButton">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>OK_pushButton</sender>
<signal>clicked()</signal>
<receiver>DisplayDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>347</x>
<y>274</y>
</hint>
<hint type="destinationlabel">
<x>199</x>
<y>149</y>
</hint>
</hints>
</connection>
</connections>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KeyStateListWidget</class>
<widget class="QWidget" name="KeyStateListWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>KeyStateListWidget</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QToolButton" name="add_toolButton">
<property name="text">
<string>+</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="remove_toolButton">
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QListWidget" name="keyState_listWidget"/>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PreDerformDialog</class>
<widget class="QDialog" name="PreDerformDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>253</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="simpleMix_checkBox">
<property name="text">
<string>Simple Mix</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="fixH_checkBox">
<property name="text">
<string>fix h factor</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDoubleSpinBox" name="h_doubleSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.050000000000000</double>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="attenuation_checkBox">
<property name="text">
<string>attenuation on</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="parallelism_checkBox">
<property name="text">
<string>parallelism</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="closeButton">
<property name="text">
<string>Fermer</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>closeButton</sender>
<signal>clicked()</signal>
<receiver>PreDerformDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>199</x>
<y>161</y>
</hint>
<hint type="destinationlabel">
<x>199</x>
<y>92</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -21,9 +21,6 @@ namespace SCHNApps{
namespace Cages{
using CtrlPosAttribute = VertexAttribute<PFP2::VEC3, PFP2::MAP>;
using InfPosAttribute= AttributeHandler<PFP2::VEC3, PFP2::MAP::VERTEX_OF_PARENT, PFP2::MAP>;
/**
* @brief The Cage2DTool struct
......@@ -98,13 +95,35 @@ using InfPosAttribute= AttributeHandler<PFP2::VEC3, PFP2::MAP::VERTEX_OF_PARENT,
*/
CageMatricesSet matricesData;
/**
* @brief affectInitialPositions
*
* The current position of all the vertices of the given cage map
* will be memorized as the 'initial positions' of the cages vertices,
* later needed for deformation computation.
*
* @param cagesMap the map containing the deformation cages
* @param cagesPosAttrHandler the vertex attribute that sets the influence cages vertices
*/
void affectInitialPositions(PFP2::MAP* cagesMap, const InfPosAttribute& cagesPosAttrHandler);
};
typedef NoTypeNameAttribute< Cage2DTool > CageTool;
/**
* @brief The Cage2DCreator class
*
* class that provides method for creating 2D cages (control and
* influence cages) on given map
*/
class Cage2DCreator{
public:
/**
* @brief The GridParams struct
*
* inner structure storing parameters for possible
* 'grid cages' creation
*/
struct GridParams{
friend class Cage2DCreator;
......@@ -115,50 +134,182 @@ using InfPosAttribute= AttributeHandler<PFP2::VEC3, PFP2::MAP::VERTEX_OF_PARENT,
size_x= bb.size(0);
size_y= bb.size(1);
}
protected:
UtilsGen::MyConvexFaceBrowser faceBrowser;
};
//virtual ~Cage2DCreator()= 0;
/**
* @brief ongoingCreation
*
* is the current object in the process of creating
* a 2d cage (but isn't done yet)?
*
* @return a boolean, yes or no
*/
inline bool ongoingCreation() {return m_currentState!=NOTHING;}
/**
* @brief reset
*
* Reset the current Cage2DCreator object.
* If it's in the middle of the process of creating a new cage,
* this cage will be discarded and the object turned back to inital state
*/
void reset();
/**
* @brief initiateCreation
*
* Initiate the process of cage 2d creation
*
* @param controlToolType the type of cage that is to be constructed
* @param map the map on which the cage should be constructed
* @param ctrlPositionAttribute the attribute handler for the control vertices of a cage
* @return a boolean, whether or not the creation succeded.
*/
bool initiateCreation(const enum Cage2DTool::Type controlToolType, PFP2::MAP* map,
const CtrlPosAttribute& ctrlPositionAttribute );
bool creationFromFile(const QString& filePath);
/**
* @brief potentialNextVertex
*
* Had a 'potential' vertex to the control cage.
* A 'potential' has to be confirmed using Cage2DCreator::confirmVertex(),
* otherwise it will be replaced by a the vertex given by the next call
* to this method or will be discarded when the control cage is validated by
* a call to Cage2DCreator::doneCtrlCreation();
*
* @param vertex the next potential vertex to add to the control cage.
*/
void potentialNextVertex(PFP2::VEC3 vertex);
/**
* @brief discardPotentialNextVertex
*
* If a 'potential' vertex is currently being added ( Cage2DCreator::potentialNextVertex() )
* but not confirmed ( Cage2DCreator::confirmVertex() ) a call to this method
* will discard it.
*/
void discardPotentialNextVertex();
/**
* @brief confirmVertex
*
* If a 'potential' vertex is currently being added ( Cage2DCreator::potentialNextVertex() ),
* a call to this method will add it definitely to the current cage.
*
* @return a boolean whether or not the vertex has indeed been confirmed
*/
bool confirmVertex();
/**
* @brief hasPotentialNextVertex
*
* Is a 'potential' vertex currently being added?
*
* @return a boolean, yes or no
*/
inline bool hasPotentialNextVertex() { return (m_currentState & HAS_POTENTIAL_NEXT); }
/**
* @brief isCurrentCtrlStateValid
*
* Does the current state of the current control cage
* ('potential' vertex not taken into account) makes it a viable
* 2D cage for MVC based deformation?
*
* @return a boolean, yes or no
*/
inline bool isCurrentCtrlStateValid() { return (m_currentState & CTRL_VALID);}
/**
* @brief doneCtrlCreation
*
* If the current state of the control cage is valid,
* then a call to this method ends the control cage creation process
* in orded to switch this object into the influence cage creation process
* (unsing Cage2DCreator::createInfluenceCage())
* (Any non confirmed 'potential' vertex is discarded)
*
* @return a boolean whether the control cage creation succeeded or not
*/
bool doneCtrlCreation();
bool createInfluenceCage(const InfPosAttribute& influencePositionAttribute);
/**
* @brief createInfluenceCage
*
* Start the influence cage creation process
* (call after the control creation process is done via
* Cage2DCreator::doneCtrlCreation()).
* Creates an influence cage where each influence vertex is separated
* for its control conterpart by a distance of 1.0
<