What is a "brep"?

What is a “brep” as used in discussions on this forum?

Here’s a wikipedia article that sums up the term much better than I could do

1 Like

Hi David- I’d read Steve’s link, but in the context of Rhino, this might help - - Rhino has different ways of representing shapes; things that show up in ‘What’ command report as surfaces or Polysurfaces are BReps, but things that are listed as Extrusions are not, though they are easily, often, and for the most part transparently converted to Breps when working with them in Rhino. (e.g. FilletEdge on an extrusion object,- Box for example- and it becomes a polysurface — a Brep.

At any rate, Extrusions are new in V5 and can cause some confusion where they do not behave exactly like Breps- that is probably where you will encounter the most discussion here. e.g. Make a box, turn on points- this works because the box is an extrusion object defined by a shape curve and an extrusion direction and has a special extrusion style grips, or points. But if you fillet an edge of this box, and then turn control points on – you cannot, the shape is now defined by the faces on all sides, edges and join information and so on - it is a polysurface and a and you do not get to turn on control points for these. (ignoring SolidPtOn for now).

More info on extrusions here:
http://wiki.mcneel.com/rhino/rhinov5status_extrusions?s[]=lightweight

Dunno if that helps or muddies- hopefully I have not told any outright lies.

-Pascal

7 Likes

Is Brep just another word for mesh? How do I get access to it in python within rhino? Can any object be treated as brep (brep a superclass?).

It’s super confusing! I am trying to call RemoveNakedMicroEdges. How do I do that within python?

It seems that you would need a Brepedgelist, which I suppose would need a Brep first??

And for fun here is catgtp’s answer:)

BREP (Boundary Representation) is a common method for representing 3D objects in computer graphics and computer-aided design (CAD). In the context of NURBS (Non-Uniform Rational B-Splines) 3D modeling, a BREP is a mathematical representation of a solid object that defines its boundaries using curves and surfaces.

A BREP model consists of a set of vertices, edges, and faces, where the faces are represented by NURBS surfaces. Each NURBS surface is defined by a set of control points, a degree, and a knot vector, which determine the shape of the surface. The boundaries of the object are defined by the edges and vertices, which are connected to form closed loops and polygons.

Overall, BREP provides a flexible and precise way to model complex 3D objects with curved surfaces, making it a popular choice in engineering and design applications.

So Brep is not mesh. It’s more precise than mesh. It’s more like vector than raster graphics? It’s NURBS, is it what you call it? Everything will turn to mesh before actual render, or do they? Is there a perfect render? Every single pixel will be calculated by a formula that define the shape, when it go to screen. I guess that would need a great deal of CPU power, instead of lots of memory??

Please ignore that ChatGTP joke, it has nothing to do with trying to run RemoveNakedMicroEdges from python, which in and of itself has nothing to do with breps since obscure specific commands like that don’t actually exist as RhinoCommon functions to call, just use the Rhinoscript “Command” function to call it. See the documentation for it here: Command

That ChatGPT crap :slight_smile: It’s just a waste of computer memory :slight_smile: It’s just search in a huge DB of facts, and put together in a grammatically correct way. Nothing really useful, or new in my opinion. Oh, it good at confusing the shit out of everyone if the world isn’t mess up enough in the current state. It’s the raster in AI :slight_smile: I am waiting for the vector in AI :slight_smile:

Anyway, I find this. So I had answer my own question about remove naked edge thing.

https://mcneel.myjetbrains.com/youtrack/issue/RH-61026

In regards to what “Breps” are in the context of Rhino scripting, here’s something I wrote in January, as I was trying to figure this out myself:

A “Surface” is a general type of object, it’s a ‘base class’ used by most of the other more specific ones. A “brep” is a surface or polysurface made up of trimmed surfaces, while a “brepface” is exactly one surface(by itself or part of a polysurface) and its trim curves.

To a great extent they’re not so much different kinds of geometry as different ways of looking at your model, you can “cast” the same object to be a “surface” or a “brep” or other things depending what you’re trying to do with it.

I heard that chatGPT could be use for coding. I think Microsoft should use that to debug it’s OS :slight_smile:

I think I should try to find a 3D CG book that I could understand and start reading it. Most of them have so much maths, it become extremely difficult to understand real quick!!

Well, although totally generic, the ChatGPT response is relatively correct, it looks like its doing what it’s designed to to, vacuum up all sorts of articles on the subject and spit out some sort of blended synopsis. The Wikipedia article in post #2 above has more detailed info on Breps.

If you are going to be doing some scripting in Rhino, at some point you will need to understand what a Brep is - as well as a number of other technical terms commonly used to define 2D and 3D geometry. If you use exclusively rhinoscriptsyntax, you will still see references to surfaces/polysurfaces, but as soon as you look under the hood (RhinoCommon for example), you will see that these are represented as Breps.

A very simplified way to look at it is that all surface or polysurface geometry in Rhino are Breps, the difference between a surface and a polysurface is that a surface is a Brep with just one face and polysurfaces are Breps that have more than one face. There are exceptions like extrusion objects, but most of the time these too have to be converted to Breps under the hood in order to work with them.

On the other hand, meshes are not Breps, they are a completely different type of entity.

So in Rhino a “Brep” is any NURBS surface or polysurface, untrimmed or trimmed. This appears to be an modification/evolution/extension/corruption of the original use of the term.

My understanding is Brep originated from the Boundary Representation method of solid/volume definition. Boundary representation defines a solid or volume as the space inside a closed surface, aka boundary. Note that “surface” is used here in the most general form, not as a specific type of entity in Rhino. The defining surface in Boundary Representation could be a single NURBS parametric surface, a collection of NURBS parametric surfaces aka polysurface, a surface mesh and other type of entities. The defining surface does need to be closed without any non-manifold structures.

“Brep” was adopted as a shorthand to designate this defining surface of a Boundary Representation solid/volume. With this general definition a Brep is not specifically a NURBS surface/polysurface but it does need to be closed and non-manifold. It could be a mesh surface.

It appears that McNeel has adopted a different defintion of Brep to mean any NURBS surface or polysurface, but not a mesh surface.

Well in my limited understanding Boundary Representation is what the name implies - surface objects represented by their boundaries - but not necessarily closed volumes. But then I am not a programmer or computer geometry mathematician.

There is also this statement from the Wikipedia article:

Boundary representation has also been extended to allow special, non-solid model types called non-manifold models . As described by Braid, normal solids found in nature have the property that, at every point on the boundary, a small enough sphere around the point is divided into two pieces, one inside and one outside the object.[citation needed] Non-manifold models break this rule. An important sub-class of non-manifold models are sheet objects which are used to represent thin-plate objects and integrate surface modelling into a solid modelling environment.

But again, non-manifold in Rhino - as well as a lot of other software - does not mean the same thing as implied above.

Actually there is a RhinoCommon method for that:

BrepEdgeList.RemoveNakedMicroEdges

(https://developer.rhino3d.com/api/RhinoCommon/html/Overload_Rhino_Geometry_Collections_BrepEdgeList_RemoveNakedMicroEdges.htm)

Regards
Jeremy

for the developers…

1 Like