Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KennethVanhoey
CGoGN
Commits
8f8fdcf4
Commit
8f8fdcf4
authored
Jul 21, 2011
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resolution bug picking frame_manip (rotation)
amelioration picking translation bug IcoSphere(1) dans Pickable
parent
df7aef97
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
32 deletions
+49
-32
include/Utils/frameManipulator.h
include/Utils/frameManipulator.h
+0
-17
include/Utils/pickables.h
include/Utils/pickables.h
+1
-1
src/Utils/frameManipulator.cpp
src/Utils/frameManipulator.cpp
+32
-13
src/Utils/pickables.cpp
src/Utils/pickables.cpp
+16
-1
No files found.
include/Utils/frameManipulator.h
View file @
8f8fdcf4
...
...
@@ -182,28 +182,11 @@ public:
*/
void
lockPicking
(
unsigned
int
axis
);
/// lock translations for picking only
void
lockPickingTranslations
();
/// lock rotations for picking only
void
lockPickingRotations
();
/// lock scales for picking only
void
lockPickingScales
();
/**
* unlock an axis (only for pinking)
*/
void
unlockPicking
(
unsigned
int
axis
);
/// unlock translations for picking only
void
unlockPickingTranslations
();
/// unlock rotations for picking only
void
unlockPickingRotations
();
/// unlock scales for picking only
void
unlockPickingScales
();
/**
* is an axis locked (only for pinking)
*/
...
...
include/Utils/pickables.h
View file @
8f8fdcf4
...
...
@@ -429,7 +429,7 @@ public:
* @param par number of parallels
* @param mer number of meridians
*/
IcoSphere
(
unsigned
int
sub
=
1
);
IcoSphere
(
unsigned
int
sub
=
5
);
/**
...
...
src/Utils/frameManipulator.cpp
View file @
8f8fdcf4
...
...
@@ -312,13 +312,17 @@ unsigned int FrameManipulator::pick(const Geom::Vec3f& PP, const Geom::Vec3f& VV
// intersection possible between line and frame (10% margin)?
float
dist2
=
Geom
::
squaredDistanceLine2Point
<
Geom
::
Vec3f
>
(
P
,
V
,
V
*
V
,
origin
);
if
(
dist2
>
(
1.05
))
float
distMax
=
std
::
max
(
m_lengthAxes
[
0
],
std
::
max
(
m_lengthAxes
[
1
],
m_lengthAxes
[
2
]));
distMax
*=
3.6
f
;
distMax
=
std
::
max
(
distMax
,
1.0
f
+
ring_half_width
);
if
(
dist2
>
distMax
*
distMax
)
return
NONE
;
// click on center
if
(
dist2
<
0.02
f
*
0.02
f
)
{
// if (! m_locked_axis[CENTER])
if
(
axisPickable
(
CENTER
))
return
CENTER
;
else
...
...
@@ -384,42 +388,57 @@ unsigned int FrameManipulator::pick(const Geom::Vec3f& PP, const Geom::Vec3f& VV
if
(
axisPickable
(
Xt
)
||
axisPickable
(
Xs
))
{
Geom
::
Vec3f
PX
(
1.0
f
,
0.0
f
,
0.0
f
);
Geom
::
Vec3f
PX
(
3.6
f
*
m_lengthAxes
[
0
]
,
0.0
f
,
0.0
f
);
dist_target
[
0
]
=
sqrt
(
Geom
::
squaredDistanceLine2Seg
(
P
,
V
,
V
*
V
,
origin
,
PX
))
;
if
(
fabs
(
dist_target
[
0
])
<
0.02
f
)
{
if
(
(
Qz
-
origin
).
norm
()
>
m_lengthAxes
[
0
]
)
if
(
axisPickable
(
Xt
)
&&
!
axisPickable
(
Xs
)
)
dist_cam
[
0
]
=
(
P
-
PX
)
*
(
P
-
PX
);
else
dist_cam
[
6
]
=
(
P
-
origin
)
*
(
P
-
origin
);
{
if
(
Qz
.
norm
()
>
m_lengthAxes
[
0
])
dist_cam
[
0
]
=
(
P
-
PX
)
*
(
P
-
PX
);
else
dist_cam
[
6
]
=
P
*
P
;
}
}
}
if
(
axisPickable
(
Yt
)
||
axisPickable
(
Ys
))
{
Geom
::
Vec3f
PY
(
0.0
f
,
1.0
f
,
0.0
f
);
Geom
::
Vec3f
PY
(
0.0
f
,
3.6
f
*
m_lengthAxes
[
1
]
,
0.0
f
);
dist_target
[
1
]
=
sqrt
(
Geom
::
squaredDistanceLine2Seg
(
P
,
V
,
V
*
V
,
origin
,
PY
))
;
if
(
fabs
(
dist_target
[
1
])
<
0.02
f
)
if
(
fabs
(
dist_target
[
1
])
<
0.02
f
)
{
if
(
(
Qz
-
origin
).
norm
()
>
m_lengthAxes
[
1
]
)
if
(
axisPickable
(
Yt
)
&&
!
axisPickable
(
Ys
)
)
dist_cam
[
1
]
=
(
P
-
PY
)
*
(
P
-
PY
);
else
dist_cam
[
7
]
=
(
P
-
origin
)
*
(
P
-
origin
);
{
if
(
Qz
.
norm
()
>
m_lengthAxes
[
1
])
dist_cam
[
1
]
=
(
P
-
PY
)
*
(
P
-
PY
);
else
dist_cam
[
7
]
=
P
*
P
;
}
}
}
if
(
axisPickable
(
Zt
)
||
axisPickable
(
Zs
))
{
Geom
::
Vec3f
PZ
(
0.0
f
,
0.0
f
,
1.0
f
);
Geom
::
Vec3f
PZ
(
0.0
f
,
0.0
f
,
3.6
f
*
m_lengthAxes
[
2
]
);
dist_target
[
2
]
=
sqrt
(
Geom
::
squaredDistanceLine2Seg
(
P
,
V
,
V
*
V
,
origin
,
PZ
));
if
(
fabs
(
dist_target
[
2
])
<
0.02
f
)
{
if
(
(
Qx
-
origin
).
norm
()
>
m_lengthAxes
[
2
]
)
if
(
axisPickable
(
Zt
)
&&
!
axisPickable
(
Zs
)
)
dist_cam
[
2
]
=
(
P
-
PZ
)
*
(
P
-
PZ
);
else
dist_cam
[
8
]
=
(
P
-
origin
)
*
(
P
-
origin
);
{
if
(
Qx
.
norm
()
>
m_lengthAxes
[
2
])
dist_cam
[
2
]
=
(
P
-
PZ
)
*
(
P
-
PZ
);
else
dist_cam
[
8
]
=
P
*
P
;
}
}
}
...
...
src/Utils/pickables.cpp
View file @
8f8fdcf4
...
...
@@ -310,6 +310,10 @@ Sphere::Sphere(unsigned int par, unsigned int mer)
void
Sphere
::
changeTopo
(
unsigned
int
parp
,
unsigned
int
mer
)
{
if
(
parp
<
2
)
parp
=
2
;
if
(
mer
<
2
)
mer
=
2
;
// to obtain right number of slice
unsigned
int
par
=
parp
-
1
;
...
...
@@ -438,6 +442,11 @@ Cone::Cone(unsigned int par, unsigned int mer)
void
Cone
::
changeTopo
(
unsigned
int
par
,
unsigned
int
mer
)
{
if
(
par
<
2
)
par
=
2
;
if
(
mer
<
2
)
mer
=
2
;
unsigned
int
merfactor
=
1
;
if
(
mer
<
8
)
...
...
@@ -558,10 +567,14 @@ Cylinder::Cylinder(unsigned int par, unsigned int mer)
void
Cylinder
::
changeTopo
(
unsigned
int
parp
,
unsigned
int
mer
)
{
if
(
parp
<
2
)
parp
=
2
;
if
(
mer
<
2
)
mer
=
2
;
// to obtain right number of slice (with almost same code as sphere)
unsigned
int
par
=
parp
+
1
;
unsigned
int
merfactor
=
1
;
if
(
mer
<
8
)
...
...
@@ -865,6 +878,8 @@ void IcoSphere::subdivide(std::vector<unsigned int>& triangles, std::vector<Geom
void
IcoSphere
::
changeTopo
(
unsigned
int
sub
)
{
if
(
sub
<
2
)
sub
=
2
;
int
subd
=
int
(
log
(
sub
/
2
)
/
log
(
2.0
))
-
1
;
if
(
subd
<
0
)
subd
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment