Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Scotty3D
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Courses
Scotty3D
Commits
5941405e
Commit
5941405e
authored
4 years ago
by
allai5
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
https://github.com/CMU-Graphics/Scotty3D
parents
519bc2c1
8ddfb4bf
Branches
Branches containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/geometry/halfedge.cpp
+5
-2
5 additions, 2 deletions
src/geometry/halfedge.cpp
src/geometry/util.cpp
+15
-7
15 additions, 7 deletions
src/geometry/util.cpp
src/gui/model.cpp
+11
-1
11 additions, 1 deletion
src/gui/model.cpp
with
31 additions
and
10 deletions
src/geometry/halfedge.cpp
+
5
−
2
View file @
5941405e
...
@@ -557,7 +557,7 @@ bool Halfedge_Mesh::subdivide(SubD strategy) {
...
@@ -557,7 +557,7 @@ bool Halfedge_Mesh::subdivide(SubD strategy) {
Index
idx
=
0
;
Index
idx
=
0
;
size_t
nV
=
vertices
.
size
();
size_t
nV
=
vertices
.
size
();
size_t
nE
=
edges
.
size
();
size_t
nE
=
edges
.
size
();
size_t
nF
=
faces
.
size
();
size_t
nF
=
faces
.
size
()
-
n_boundaries
()
;
verts
.
resize
(
nV
+
nE
+
nF
);
verts
.
resize
(
nV
+
nE
+
nF
);
for
(
VertexRef
v
=
vertices_begin
();
v
!=
vertices_end
();
v
++
,
idx
++
)
{
for
(
VertexRef
v
=
vertices_begin
();
v
!=
vertices_end
();
v
++
,
idx
++
)
{
...
@@ -568,12 +568,15 @@ bool Halfedge_Mesh::subdivide(SubD strategy) {
...
@@ -568,12 +568,15 @@ bool Halfedge_Mesh::subdivide(SubD strategy) {
verts
[
idx
]
=
e
->
new_pos
;
verts
[
idx
]
=
e
->
new_pos
;
layout
[
e
->
id
()]
=
idx
;
layout
[
e
->
id
()]
=
idx
;
}
}
for
(
FaceRef
f
=
faces_begin
();
f
!=
faces_end
();
f
++
,
idx
++
)
{
for
(
FaceRef
f
=
faces_begin
();
f
!=
faces_end
();
f
++
)
{
if
(
f
->
is_boundary
())
continue
;
verts
[
idx
]
=
f
->
new_pos
;
verts
[
idx
]
=
f
->
new_pos
;
layout
[
f
->
id
()]
=
idx
;
layout
[
f
->
id
()]
=
idx
;
idx
++
;
}
}
for
(
auto
f
=
faces_begin
();
f
!=
faces_end
();
f
++
)
{
for
(
auto
f
=
faces_begin
();
f
!=
faces_end
();
f
++
)
{
if
(
f
->
is_boundary
())
continue
;
Index
i
=
layout
[
f
->
id
()];
Index
i
=
layout
[
f
->
id
()];
HalfedgeRef
h
=
f
->
halfedge
();
HalfedgeRef
h
=
f
->
halfedge
();
do
{
do
{
...
...
This diff is collapsed.
Click to expand it.
src/geometry/util.cpp
+
15
−
7
View file @
5941405e
...
@@ -200,24 +200,32 @@ Data cone(float bradius, float tradius, float height, int sides, bool caps) {
...
@@ -200,24 +200,32 @@ Data cone(float bradius, float tradius, float height, int sides, bool caps) {
size_t
vert
=
0
;
size_t
vert
=
0
;
vertices
[
vert
++
]
=
Vec3
(
0.0
f
,
0.0
f
,
0.0
f
);
vertices
[
vert
++
]
=
Vec3
(
0.0
f
,
0.0
f
,
0.0
f
);
float
t
=
0.0
f
;
float
step
=
_2pi
/
n_sides
;
while
(
vert
<=
n_sides
)
{
while
(
vert
<=
n_sides
)
{
float
rad
=
(
float
)
vert
/
n_sides
*
_2pi
;
vertices
[
vert
]
=
Vec3
(
std
::
cos
(
t
)
*
bradius
,
0.0
f
,
std
::
sin
(
t
)
*
bradius
);
vertices
[
vert
]
=
Vec3
(
std
::
cos
(
rad
)
*
bradius
,
0.0
f
,
std
::
sin
(
rad
)
*
bradius
);
vert
++
;
vert
++
;
t
+=
step
;
}
}
vertices
[
vert
++
]
=
Vec3
(
0.0
f
,
height
,
0.0
f
);
vertices
[
vert
++
]
=
Vec3
(
0.0
f
,
height
,
0.0
f
);
t
=
0.0
f
;
while
(
vert
<=
n_sides
*
2
+
1
)
{
while
(
vert
<=
n_sides
*
2
+
1
)
{
float
rad
=
(
float
)(
vert
-
n_sides
-
1
)
/
n_sides
*
_2pi
;
vertices
[
vert
]
=
Vec3
(
std
::
cos
(
t
)
*
tradius
,
height
,
std
::
sin
(
t
)
*
tradius
);
vertices
[
vert
]
=
Vec3
(
std
::
cos
(
rad
)
*
tradius
,
height
,
std
::
sin
(
rad
)
*
tradius
);
vert
++
;
vert
++
;
t
+=
step
;
}
}
size_t
v
=
0
;
size_t
v
=
0
;
t
=
0.0
f
;
while
(
vert
<=
vertices
.
size
()
-
4
)
{
while
(
vert
<=
vertices
.
size
()
-
4
)
{
float
rad
=
(
float
)
v
/
n_sides
*
_2pi
;
vertices
[
vert
]
=
Vec3
(
std
::
cos
(
t
)
*
tradius
,
height
,
std
::
sin
(
t
)
*
tradius
);
vertices
[
vert
]
=
Vec3
(
std
::
cos
(
rad
)
*
tradius
,
height
,
std
::
sin
(
rad
)
*
tradius
);
vertices
[
vert
+
1
]
=
Vec3
(
std
::
cos
(
t
)
*
bradius
,
0.0
f
,
std
::
sin
(
t
)
*
bradius
);
vertices
[
vert
+
1
]
=
Vec3
(
std
::
cos
(
rad
)
*
bradius
,
0.0
f
,
std
::
sin
(
rad
)
*
bradius
);
vert
+=
2
;
vert
+=
2
;
v
++
;
v
++
;
t
+=
step
;
}
}
vertices
[
vert
]
=
vertices
[
n_sides
*
2
+
2
];
vertices
[
vert
]
=
vertices
[
n_sides
*
2
+
2
];
vertices
[
vert
+
1
]
=
vertices
[
n_sides
*
2
+
3
];
vertices
[
vert
+
1
]
=
vertices
[
n_sides
*
2
+
3
];
...
...
This diff is collapsed.
Click to expand it.
src/gui/model.cpp
+
11
−
1
View file @
5941405e
...
@@ -253,7 +253,7 @@ void Model::edge_viz(Halfedge_Mesh::EdgeRef e, Mat4& transform) {
...
@@ -253,7 +253,7 @@ void Model::edge_viz(Halfedge_Mesh::EdgeRef e, Mat4& transform) {
float
v0s
=
vert_sizes
[
v_0
->
id
()],
v1s
=
vert_sizes
[
v_1
->
id
()];
float
v0s
=
vert_sizes
[
v_0
->
id
()],
v1s
=
vert_sizes
[
v_1
->
id
()];
float
s
=
0.5
f
*
std
::
min
(
v0s
,
v1s
);
float
s
=
0.5
f
*
std
::
min
(
v0s
,
v1s
);
if
(
dir
.
y
==
1.0
f
||
dir
.
y
==
-
1.0
f
)
{
if
(
1.0
f
-
std
::
abs
(
dir
.
y
)
<
EPS_F
)
{
l
*=
sign
(
dir
.
y
);
l
*=
sign
(
dir
.
y
);
transform
=
Mat4
{
Vec4
{
s
,
0.0
f
,
0.0
f
,
0.0
f
},
Vec4
{
0.0
f
,
l
,
0.0
f
,
0.0
f
},
transform
=
Mat4
{
Vec4
{
s
,
0.0
f
,
0.0
f
,
0.0
f
},
Vec4
{
0.0
f
,
l
,
0.0
f
,
0.0
f
},
Vec4
{
0.0
f
,
0.0
f
,
s
,
0.0
f
},
Vec4
{
v0
,
1.0
f
}};
Vec4
{
0.0
f
,
0.0
f
,
s
,
0.0
f
},
Vec4
{
v0
,
1.0
f
}};
...
@@ -381,6 +381,16 @@ void Model::rebuild() {
...
@@ -381,6 +381,16 @@ void Model::rebuild() {
// Create cylinder for each edge
// Create cylinder for each edge
cylinders
.
clear
();
cylinders
.
clear
();
for
(
auto
e
=
mesh
.
edges_begin
();
e
!=
mesh
.
edges_end
();
e
++
)
{
for
(
auto
e
=
mesh
.
edges_begin
();
e
!=
mesh
.
edges_end
();
e
++
)
{
// We don't want to render edges between two boundary faces, since the boundaries
// should look contiguous
if
(
e
->
halfedge
()
->
is_boundary
()
&&
e
->
halfedge
()
->
twin
()
->
is_boundary
())
{
// Unless both surrounding boundaries are the same face, in which case we should
// render this edge to show that the next vertex is connected
if
(
e
->
halfedge
()
->
face
()
!=
e
->
halfedge
()
->
twin
()
->
face
())
continue
;
}
Mat4
transform
;
Mat4
transform
;
edge_viz
(
e
,
transform
);
edge_viz
(
e
,
transform
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment