Skip to content

Commit

Permalink
Merge pull request #92 from GregoryLi0/nurbs_editing
Browse files Browse the repository at this point in the history
NURBS editing Milestone 2: Perform advanced operations on brep geometries using command line, as well as some simple ones.
**Curve operations:**
- curve remove
- curve split
- curve copy
**Surface operations:**
- surface remove
- surface split
- surface copy
- create by tensor product
- create by rotating a curve around an axis by an angle
- global surface interpolation with C2 continuity
  • Loading branch information
drossberg authored Aug 13, 2023
2 parents c5dcd0b + 5ce3b02 commit abe83b1
Show file tree
Hide file tree
Showing 5 changed files with 806 additions and 151 deletions.
69 changes: 66 additions & 3 deletions include/brep/edit.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ extern "C++"
BREP_EXPORT extern int
brep_curve_interpCrv(ON_Brep *brep, std::vector<ON_3dPoint> points);

/**
* copy a curve from brep
* return id of the new curve
*/
BREP_EXPORT extern int
brep_curve_copy(ON_Brep *brep, int curve_id);

/**
* remove a curve from brep
* @attention the index of m_C3 is changed after remove!!!
*/
BREP_EXPORT extern bool
brep_curve_remove(ON_Brep *brep, int curve_id);

/**
* move curve along a vector.
*/
Expand All @@ -85,7 +99,7 @@ extern "C++"
brep_curve_set_cv(ON_Brep *brep, int curve_id, int cv_id, const ON_4dPoint &point);

/**
* Reverse parameterizatrion by negating all knots
* reverse parameterizatrion by negating all knots
* and reversing the order of the control vertices.
*/
BREP_EXPORT extern bool
Expand All @@ -104,9 +118,15 @@ extern "C++"
brep_curve_trim(ON_Brep *brep, int curve_id, double t0, double t1);

/**
* Join the end of curve_id_1 to the start of curve_id_2.
* split a curve at a parameter. Old curve will be deleted.
*/
BREP_EXPORT extern bool
brep_curve_split(ON_Brep *brep, int curve_id, double t);

/**
* join the end of curve_id_1 to the start of curve_id_2.
* return id of the new curve, delete the two old curves.
* Remark: the index of C3 is changed after join!!!
* @attention the index of m_C3 is changed after join!!!
*/
BREP_EXPORT extern int
brep_curve_join(ON_Brep *brep, int curve_id_1, int curve_id_2);
Expand All @@ -119,6 +139,22 @@ extern "C++"
BREP_EXPORT extern int
brep_surface_make(ON_Brep *brep, const ON_3dPoint &position);

/**
* create a bicubic nurbs surface by interpolating a set of points
* return id of the surface
* method: Global cubic interpolation with C2 continuity
* reference: The NURBS Book (2nd Edition), chapter 9.2.5
*/
BREP_EXPORT extern int
brep_surface_interpCrv(ON_Brep *brep, int cv_count_x, int cv_count_y, std::vector<ON_3dPoint> points);

/**
* copy a surface from brep
* return id of the new surface
*/
BREP_EXPORT extern int
brep_surface_copy(ON_Brep *brep, int surface_id);

/**
* move surface to a new position
*/
Expand All @@ -139,6 +175,12 @@ extern "C++"
BREP_EXPORT extern bool
brep_surface_trim(ON_Brep *brep, int surface_id, int dir, double t0, double t1);

/**
* split a surface at a parameter. Old surface will be deleted.
*/
BREP_EXPORT extern bool
brep_surface_split(ON_Brep *brep, int surface_id, int dir, double t);

/**
* create a ruled surface.
* The two curves must have the same NURBS form knots.
Expand All @@ -147,6 +189,27 @@ extern "C++"
*/
BREP_EXPORT extern int
brep_surface_create_ruled(ON_Brep *brep, int curve_id0, int curve_id1);

/**
* create a surface by extruding a curve along another curve.
* return: if successful, id of the new surface; otherwise, -1.
*/
BREP_EXPORT extern int
brep_surface_tensor_product(ON_Brep *brep, int curve_id0, int curve_id1);

/**
* create a surface by rotating a curve around an axis.
* return: if successful, id of the new surface; otherwise, -1.
*/
BREP_EXPORT extern int
brep_surface_revolution(ON_Brep *brep, int curve_id0, ON_3dPoint line_start, ON_3dPoint line_end, double angle = 2 * ON_PI);

/**
* remove a surface from brep
* @attention the index of m_S is changed after remove!!!
*/
BREP_EXPORT extern bool
brep_surface_remove(ON_Brep *brep, int surface_id);
} /* extern C++ */
#endif

Expand Down
Loading

0 comments on commit abe83b1

Please sign in to comment.