-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from GenerateNU/features/tangent-vectors-geom_…
…bspline Features/tangent vectors geom bspline
- Loading branch information
Showing
5 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"files.associations": { | ||
"__bit_reference": "cpp", | ||
"__config": "cpp", | ||
"__debug": "cpp", | ||
"__errc": "cpp", | ||
"__hash_table": "cpp", | ||
"__locale": "cpp", | ||
"__mutex_base": "cpp", | ||
"__node_handle": "cpp", | ||
"__split_buffer": "cpp", | ||
"__threading_support": "cpp", | ||
"__verbose_abort": "cpp", | ||
"array": "cpp", | ||
"atomic": "cpp", | ||
"bitset": "cpp", | ||
"cctype": "cpp", | ||
"charconv": "cpp", | ||
"clocale": "cpp", | ||
"cmath": "cpp", | ||
"complex": "cpp", | ||
"cstdarg": "cpp", | ||
"cstddef": "cpp", | ||
"cstdint": "cpp", | ||
"cstdio": "cpp", | ||
"cstdlib": "cpp", | ||
"cstring": "cpp", | ||
"ctime": "cpp", | ||
"cwchar": "cpp", | ||
"cwctype": "cpp", | ||
"exception": "cpp", | ||
"fstream": "cpp", | ||
"initializer_list": "cpp", | ||
"iomanip": "cpp", | ||
"ios": "cpp", | ||
"iosfwd": "cpp", | ||
"iostream": "cpp", | ||
"istream": "cpp", | ||
"limits": "cpp", | ||
"locale": "cpp", | ||
"mutex": "cpp", | ||
"new": "cpp", | ||
"optional": "cpp", | ||
"ostream": "cpp", | ||
"ratio": "cpp", | ||
"sstream": "cpp", | ||
"stdexcept": "cpp", | ||
"streambuf": "cpp", | ||
"string": "cpp", | ||
"string_view": "cpp", | ||
"system_error": "cpp", | ||
"tuple": "cpp", | ||
"typeinfo": "cpp", | ||
"unordered_map": "cpp", | ||
"variant": "cpp", | ||
"vector": "cpp", | ||
"algorithm": "cpp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"tasks": [ | ||
{ | ||
"type": "cppbuild", | ||
"label": "C/C++: clang build active file", | ||
"command": "/usr/bin/clang", | ||
"args": [ | ||
"-fcolor-diagnostics", | ||
"-fansi-escape-codes", | ||
"-g", | ||
"${file}", | ||
"-o", | ||
"${fileDirname}/${fileBasenameNoExtension}" | ||
], | ||
"options": { | ||
"cwd": "${fileDirname}" | ||
}, | ||
"problemMatcher": [ | ||
"$gcc" | ||
], | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
}, | ||
"detail": "Task generated by Debugger." | ||
} | ||
], | ||
"version": "2.0.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
#include <Geom_Curve.hxx> | ||
#include <Geom_BSplineCurve.hxx> | ||
#include <GeomLProp_SLProps.hxx> | ||
#include <gp_Pnt.hxx> | ||
#include <gp_Vec.hxx> | ||
#include <vector> | ||
#include <iostream> | ||
|
||
// outputs a list of vectors containing the tangents to the knots on the curve | ||
std::vector<gp_Vec> calculate_tangent_vectors(const Handle(Geom_BSplineCurve)& bsplineCurve) { | ||
std::vector<gp_Vec> tangentVectors; | ||
gp_Vec tangentVector; | ||
gp_Pnt point; | ||
int knots = bsplineCurve->NbKnots(); | ||
Standard_Real step_size = 1 / knots; | ||
Standard_Real first_parameter = bsplineCurve->FirstParameter(); | ||
Standard_Real last_parameter = bsplineCurve->LastParameter(); | ||
for (int u = first_parameter; u < last_parameter; u += step_size) { | ||
bsplineCurve->D1(u, point, tangentVector); | ||
tangentVectors.push_back(tangentVector); | ||
} | ||
return tangentVectors; | ||
} | ||
|
||
int main(int argc, char* argv[]) { | ||
return 1; | ||
} |