src/geometry/linesegment.h

Sat, 17 Mar 2018 12:29:52 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Sat, 17 Mar 2018 12:29:52 +0200
changeset 1294
adaad0b329e2
parent 1251
e75cc5bff076
child 1315
23d48a709ffc
permissions
-rw-r--r--

Added a new tool for clamping vertices

1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
1 /*
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
3 * Copyright (C) 2013 - 2017 Teemu Piippo
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
4 *
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
8 * (at your option) any later version.
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
9 *
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
13 * GNU General Public License for more details.
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
14 *
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
17 */
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
18
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
19 #pragma once
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
20 #include "../basics.h"
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
21
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
22 /*
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
23 * Models a 3D line segment.
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
24 */
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
25 struct LineSegment
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
26 {
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
27 Vertex v_1;
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
28 Vertex v_2;
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
29
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
30 QPair<Vertex, Vertex> toPair() const;
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
31 };
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
32
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
33 LineSegment normalized(const LineSegment& segment);
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
34 unsigned int qHash(const LineSegment& segment);
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
35 bool operator==(const LineSegment& one, const LineSegment& other);
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents:
diff changeset
36 bool operator<(const LineSegment& one, const LineSegment& other);

mercurial