Skip to content

Commit

Permalink
シミュレーションに影響しない独自実装軸(SymmetryAxisNormal)に変更した。with #53
Browse files Browse the repository at this point in the history
  • Loading branch information
DrScKAWAMOTO authored and DrScKAWAMOTO committed Jul 1, 2014
1 parent c78c83c commit ce85b98
Show file tree
Hide file tree
Showing 9 changed files with 269 additions and 154 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

# Project Specific Executables
src/Qt/fl-guruguru
src/Qt/fl-guruguru.core
src/ca-char
src/ca-cmp
src/ca-generator
Expand Down
38 changes: 5 additions & 33 deletions src/CarbonAllotrope.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "InteractivePlane.h"
#include "InteractiveLine.h"
#include "ThreeViewNormal.h"
#include "SymmetryAxisNormal.h"
#include "Automorphism.h"
#include "Statistics.h"
#include "Utils.h"
Expand Down Expand Up @@ -1228,42 +1229,13 @@ void CarbonAllotrope::register_interactions()
List<SymmetryAxis> major_axes;
get_major_axes(major_axes);
int list_len = major_axes.length();
printf("list_len = %d\n", list_len);
for (int j = 0; j < list_len; ++j)
{
SymmetryAxis* major_axis = major_axes[j];
Automorphism* generator = major_axis->get_generator();
int order = major_axis->get_order();
InteractiveLine* axis_line = new InteractiveLine(this, 0);
axis_line->fix_center_location(Vector3());
reset_done();
int len = number_of_carbons();
while (1)
{
Carbon* carbon;
int i;
for (i = 0; i < len; ++i)
{
carbon = get_carbon(i);
if (!carbon->get_done())
break;
}
if (i == len)
break;
InteractiveRegularPolygon* poly =
new InteractiveRegularPolygon(this, 0, 10.0, order);
p_register_interaction(NORMAL_FORCE_TYPE_DIRECTION_ARRANGEMENT,
axis_line, poly);
p_register_interaction(LOCATION_FORCE_TYPE_ATTRACTIVE,
poly, ACTION_LOCATION_CENTER,
axis_line, ACTION_LOCATION_NEAREST);
for (i = 0; i < order; ++i)
{
carbon->set_done();
p_register_interaction(LOCATION_FORCE_TYPE_ATTRACTIVE,
poly, i, carbon, ACTION_LOCATION_CENTER);
carbon = get_carbon_by_sequence_no((*generator)(carbon->sequence_no()));
}
}
major_axis->print_out();
SymmetryAxisNormal* axis_normal = new SymmetryAxisNormal(this, major_axis);
p_register_interaction(ORIGINAL_FORCE_TYPE_ORIGINAL, axis_normal);
}
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion src/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// #define CONFIG_DRAW_PRINCIPAL_COMPONENT_AXES_IN_GURUGURU_MODE 1

/* fl-guruguru のぐるぐるモードで主要対象軸を表示する。 */
// #define CONFIG_DRAW_MAJOR_AXES_SYMMETRY_IN_GURUGURU_MODE 1
#define CONFIG_DRAW_MAJOR_AXES_SYMMETRY_IN_GURUGURU_MODE 1

/* fl-guruguru の POVRay スナップショットの背景を透明色にする。 */
// #define CONFIG_PAINT_TRANSPARENT_COLOR_TO_BACKGROUND_IN_POVRAY_SNAPSHOT 1
Expand Down
271 changes: 153 additions & 118 deletions src/Depend.mk

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/Qt/fl-guruguru.pro
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ HEADERS += ../Automorphism.h \
../SortedList.h \
../Statistics.h \
../SymmetryAxis.h \
../SymmetryAxisNormal.h \
../ThreeViewNormal.h \
../Utils.h \
../Vector3.h \
Expand Down Expand Up @@ -113,6 +114,7 @@ SOURCES += ../Automorphism.cc \
../Ring.cc \
../Statistics.cc \
../SymmetryAxis.cc \
../SymmetryAxisNormal.cc \
../ThreeViewNormal.cc \
../Utils.cc \
../Vector3.cc \
Expand Down
2 changes: 1 addition & 1 deletion src/Ring.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Ring : public InteractiveRegularPolygon {
private:
int p_number_of_carbons;
List<Carbon> p_carbons;
Vector3 p_center_location;
// TODO not used Vector3 p_center_location;
double p_radius;
int p_clockwise;
int p_ring_color;
Expand Down
55 changes: 55 additions & 0 deletions src/SymmetryAxisNormal.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Project: FullereneViewer
* Version: 1.0
* Copyright: (C) 2011-14 Dr.Sc.KAWAMOTO,Takuji (Ext)
* Create: 2011/12/26 18:06:18 JST
*/

#include <assert.h>
#include "SymmetryAxisNormal.h"
#include "CarbonAllotrope.h"
#include "OpenGLUtil.h"

SymmetryAxisNormal::SymmetryAxisNormal(CarbonAllotrope* ca, SymmetryAxis* axis)
: InteractiveRegularPolygon(ca, 0, 1.0, 2), p_ca(ca), p_axis(axis)
{
}

SymmetryAxisNormal::~SymmetryAxisNormal()
{
}

void SymmetryAxisNormal::reset_interaction()
{
InteractiveRegularPolygon::reset_interaction();
}

void SymmetryAxisNormal::interaction_original(OriginalForceType force_type,
Interactives* interactives, double delta)
{
assert(p_axis->get_type() == AXIS_TYPE_CENTER_OF_RING);
int north = p_axis->get_north_sequence_no();
int south = p_axis->get_south_sequence_no();
Ring* north_ring = p_ca->get_ring_by_sequence_no(north);
Ring* south_ring = p_ca->get_ring_by_sequence_no(south);
Vector3 north_location = north_ring->get_center_location();
Vector3 south_location = south_ring->get_center_location();
Vector3 normal = north_location - south_location;
p_normal.clockwise = 1;
fix_center_location(p_ca->get_center_location());
fix_radius_length(normal.abs() * 0.55);
fix_posture(Matrix3(Quaternion(Vector3(0.0, 0.0, 1.0), normal)));
}

void SymmetryAxisNormal::draw_opaque_by_OpenGL(bool selection) const
{
Vector3 norm = get_normal();
norm *= p_radius.length;
OpenGLUtil::set_color(0x00ff00);
OpenGLUtil::draw_cylinder(0.4, get_center_location() - norm,
get_center_location() + norm);
}

/* Local Variables: */
/* mode: c++ */
/* End: */
50 changes: 50 additions & 0 deletions src/SymmetryAxisNormal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Project: FullereneViewer
* Version: 1.0
* Copyright: (C) 2011-14 Dr.Sc.KAWAMOTO,Takuji (Ext)
* Create: 2011/12/26 18:06:18 JST
*/

#ifndef __SYMMETRYAXISNORMAL_H__
#define __SYMMETRYAXISNORMAL_H__

#include <stdio.h>
#include "InteractiveRegularPolygon.h"
#include "CarbonAllotrope.h"

class SymmetryAxisNormal : public InteractiveRegularPolygon {
// friend classes & functions

// members
private:
CarbonAllotrope* p_ca;
SymmetryAxis* p_axis;

// private tools
private:

// constructors & the destructor
public:
SymmetryAxisNormal(CarbonAllotrope* ca, SymmetryAxis* axis);
virtual ~SymmetryAxisNormal();
Bond& operator = (const SymmetryAxisNormal& that); /* dont use */

// interactions
public:
virtual void reset_interaction();
virtual void interaction_original(OriginalForceType force_type,
Interactives* interactives, double delta);

// I/O
public:
virtual void draw_opaque_by_OpenGL(bool selection) const;

// member accessing methods

};

#endif /* __SYMMETRYAXISNORMAL_H__ */

/* Local Variables: */
/* mode: c++ */
/* End: */
2 changes: 1 addition & 1 deletion src/ThreeViewNormal.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ThreeViewNormal : public InteractiveRegularPolygon {

};

#endif /* __BOND_H__ */
#endif /* __THREEVIEWNORMAL_H__ */

/* Local Variables: */
/* mode: c++ */
Expand Down

0 comments on commit ce85b98

Please sign in to comment.