# The Real History of the C3D Kernel from Andrey Penkin

## «If a problem is unsolvable, that does not necessarily mean the assignment is impossible to complete»

This year C3D Labs celebrates the 20th anniversary of its C3D geometric kernel. Twenty years ago the founders of ASCON Group made the decision to begin writing a new mechanical CAD system, today known as KOMPAS-3D. To power the system, the company established a team to write a 3D kernel good enough to compete with foreign kernels in operability and functions. This is where the history of the "Kolomna" geometric kernel begins.

During the years that followed, ASCON continuously developed and improved the kernel. New modeling methods were invented, computational algorithms were developed, and additional modules were added such as a parametric solver, the data converter, and a visualization module. Behind all these changes, there always were a special group of people developing the geometric kernel, which recently was renamed C3D.

Today, people take a greater interest in geometric modeling, some of whom keep tabs on who develops what. So to celebrate the 20th anniversary, we decided to conduct interviews with our development team. In our first two issues, we interviewed two members of the staff who joined our team recently: Anna Ladilova and Alexander Alakhverdyants. Not to lead our readers into thinking that C3D Lab's team is too young, we have decided for our third interview to choose a senior team member. **Andrey Penkin** is from the department responsible for the development of the C3D Modeler. The interview was conducted by C3D product manager **Arkadiy Kamnev**.

**Andrey, let me begin with the question I ask right out of the gate: where are you from?**

I'm from Kolomna. I spent my childhood and graduated high school there. Then I went on to Lomonosov Moscow State University (MSU), where I studied math in the Mechanics and Mathematics Department and majored in complex analysis.

**Why did you choose to go to MSU?**

It was a chain of random events. Originally, I thought of a lot of different career paths, even military officer and musician. I even went to music school for a while as a bayan (accordion) player, but eventually decided against moving up to Kolomna music college as I first felt that music was not my calling. The military, on the other hand, was far more appealing. I knew a lot of military officers, and they painted for me a nice picture of what military service was like. According to them, as a service man I could be stationed in the polar regions, in the Far East of Russia, or in some other warmer place. Their stories inspired me.

**But you went with math instead. Why's that?**

At one point, quite by chance, I ended up in conversation with a stranger. We went through the usual questions, like "What college are you going to?" I said my goal after 8th grade was to get into a military school, but this person convinced me to to change my mind, and I decided to try the Moscow Aviation Institute. But I was dissuaded as they didn’t offer dormitory accommodation. As a result, I ended up taking admission exams for MSU and they accepted me.

**What were your favorite subjects while studying at MSU?**

I liked complex analysis and algebra. I think that complex numbers and the theory behind them are by far more orderly than just real numbers.

It took me some time for me to get the hang of algebra, however. We were given textbooks that discussed modules, groups, and operations research in such a complex manner that it made no sense to me. Then I found books that gave simpler explanations, and eventually I mastered textbooks written by the head of the department, Dr. Alexey Kostrikin.

The only thing that could be counted as a minus during my studies was the lack of a direct link with practical matters. It's all well and good to sit around and theorize as much as we like, but it's unclear who and what it's all for.

**What plans did you make for after graduation?**

My academic adviser tried to get me to stay on as an MSU post-graduate student, but by that time I had gotten pretty tired of all the theoretical stuff, so I turned down their offer.

I found a job at a steam plant and spent almost a year working there. It gave me plenty of free time, and so reading became my favorite hobby. One employee I met at the steam plant spoke pretty good English and was very savvy when it came to electronics. This was the first time someone explained to me how simple it is to assemble a computer with your own hands. I got excited about the idea, and after one or two tries put together my own PC running an AMD Am486 CPU. I still remember that the most impressive component for me was the keyboard. When I saw it, I knew there that I was going to get that PC up and working.

**OK, so how did you end up working at the Machinery Design Bureau (MDB) in Kolomna, and what were your responsibilities there?**

Some people I knew who used to work at the MDB recommended it to me. I followed their advice, got hired by MDB, and became involved in the engineering calculations of rocket designs. At long last I was given practical tasks to handle with my theoretical background in mathematics. This turned out be quite a shock to me, because it is one thing to develop algorithms in a classroom environment, and quite another to actually apply them in the field.

As a result, I learned an important lesson during my time at MDB: no matter what task you are assigned, you must accomplish it. It is not good enough to prove that it cannot be done. So, I started mulling things over: I can prove that this problem cannot be solved in for general cases, so I have to arrive at other conclusions for the absolute majority of cases that it applies to. This for me was a new thing to learn.

**What followed your time at MDB?**

Some friends told me about KOMPAS CAD, which was being developed by some former MDB employees who called themselves ASCON. I knew that the company needed programmers, and so I sent ASCON my resume. I was offered a job straight away in their math department, which at the time only had three other staff members -- Dr. Nikolay Golovanov, Alexander Maksimenko, and Dmitry Zhamoytsin. I accepted the offer, and I began by fixing bugs, then assisted Alexander Maximenko in the implementation of a geometric solver. In particular, I was charged with filling out a table of functions performing set constraints for the available degrees of freedom.

The development of KOMPAS required us to write a set of rather complex functions, such as ones for stitching together 3D faces. Often models imported from other design systems represent 3D elements as sets of faces, not solid bodies with topology. My task was to detect those faces and then identify the bodies to which they belonged -- followed by the restoration of their topology with all edges and vertices.

I first developed a method that worked well at stitching cubes. But when more complex 3D parts came along, my algorithm failed and I didn't know why. Discussing the problem with my colleagues, I found out that Alexander Maximenko in the past had worked on a similar issue in determining pattern tapers; he needed to find where edges and vertices converged. My mistake was that I used the edges as the starting point, whereas Alexander's approach was to start with vertices: group them first, and then work out which edges belong to each. And it worked for me!

**Sewing edges together: is this what converters do, or is it the job of the geometric kernel?**

This function is available in both our file converter and the geometrical kernel, but initially it was the job of our converter. I began with some simple stitching cases, and then moved on to more complex ones. I found that some design systems define their faces with very low precision -- these had to be recognized, redrawn, redefined with greater precision, and so on. I developed algorithms that cut edges in some cases, and in other cases fills in gaps. What's remarkable about C3D is that when it sews together edges, there no longer is any need to get a closed body or shell.

Occasionally there would be a mix-up or two. One time a tester came up to me and said, "Andrey, look, I created a cube, removed one face, and told it to sew up the remaining faces. But instead, it restored the removed face." This, of course, should not have happened; there's no need to think ahead on behalf of the user. So I changed my assumption in the algorithm.

I am now working on functions that work with sheet bodies. The terms of reference have been written, and now I'm working on this solving the problem full-time.

**Can you describe in greater detail how you work with sheet bodies?**

Functions for creating sheet bodies involve bending, unbending, and stamping. I should emphasize that these operations are **flat out not available in other geometric kernels**. This makes our C3D product unique. If you compare C3D with CAD software, bending operations are quite evolved in our product and they continue to improve.

When you have access to the geometric kernel's functions, you can create special bent/unbent surfaces or, for example, determine the location of points after a bend/unbend operation. The good thing about sheet bodies is that they are, for the most part, flat. This helps a great deal when working with them. When such bodies are united or overlapping, special functions join sheets together along their narrow edges, and these work faster because they take into account the peculiarities of sheet bodies.

What makes bending operations complicated is the fact that any part we bend will eventually have to be unbent -- to get the flat pattern with all its complexity form cutouts, overlaps, and bosses. In practice, cutouts made while bent have a different shape from ones made on flat surfaces.

A feature of any geometric kernel is that formulas it uses give absolutely accurate values, whereas practical calculations always contain some inaccuracy. In essence, theory is too perfect, which can make a mess of things! A solution found numerically is sometimes much more accurate than a value calculated using a formula. This should be taken into account in one's work.

**What do you most enjoy in your work? **

The coffee and cake! Well, all joking aside, almost all my assignments are unique, and so I enjoy the new challenges that come my way. It never is clear from the start how to tackle new ones. Right before I take on a new task, it’s not uncommon for me to experience slight despair: the task must be accomplished, but it's not at all clear how I can complete it within a narrow timeframe. Then I start to just think, running through different details and nuances. I start with the simple things, move on to more complex issues, and then on to the most complex ones. After much trial and error, I finally hit the correct solution, and I feel on top of the world! I realize that I've done it, that it worked out well in the end.

The work we do is like a kind of pendulum, moving us from despair to bliss-untold when the project is complete. It helps that we have such a nice team! Because of them I have no regret whatsoever working at C3D Labs.

**Tell me a bit about how CAD developers can benefit from using C3D.**

It is very important for CAD developers to have customer support close at hand. Our number-one strength is in the attentiveness we pay our clients. No matter what question users have, we are always there to help.

**You mentioned you know several programming languages. Can you tell us about them?**

Back in school, they taught us regular BASIC, and then during my university years I learned FORTRAN and Pascal. I mastered С++ while I was in military service. More recently I tried learning Python, but it as had nothing to do with my work, my interest dissipated quickly.

Here’s how I got into programming in the first place: when I was 15, I bought an Elektronika MK-61 programmable calculator. It was the first programmable device of any kind that I could tinker around with. It boasted 105 memory cells and allowed me to program some simple formulas. It even offered games, like a racing game. To control, the car I had to use the number keys.

It was in my 9th grade when I finally laid my hands on a proper computer, an 8-bit Radio-86RK. To load BASIC into its memory, I had to use a tape recorder. The first program I wrote was to find the roots of quadratic equations.

**I heard that you like learning foreign languages. What languages do you know aside from Russian and English?**

During my university years I took to learning languages, starting with English. But I found that studying it through textbooks uninteresting and, I would say, even boring, and I nearly gave it up. But then my teacher introduced me to an American who ran an English course at MSU. I attended his classes and we became well acquainted.

Later, I needed knowledge of French for my studies, as there were many interesting articles written in French at the time. I learned to read French in several stages, so I can't say I speak French very well. Now my goal is to learn Chinese, as I find the culture of China and the county itself really interesting.

**What hobbies do you have?**

I like reading books in their original language. For example, I like the science fiction works of mathematician and programmer Vernor Vinge. I can readily identify with what he writes. Robert Jordan is another good author, in my opinion.

In French I've read The Little Prince by Antoine de Saint-Exupéry, and several others by lesser known authors. Out of the classics, I can mention Charlotte Bronte's Jane Eyre and The Idiot by Fedor Dostoyevsky. If our friends from other countries form their understanding of Russians based on Fyodor Mikhailovich's works, I cannot begin to imagine how horrified they must be are after reading them!

**I know you like cycling. Have you ever gone racing?**

I don't like races for what they are. At one time, I rode my bike as fast as I could, but then I stopped after I asked myself, “Why are you speeding along with your tongue hanging out? You can just bike to watch the world around you at a normal speed!” Since then I've had no real interest in being in races; I don't care about reaching my destination quicker than anyone else.

**Do you find yourself thinking about work in the evenings?**

When I arrive home, no thoughts about work are permitted. However, on my way home I usually get my best ideas. I sit the whole day racking my brain, thinking about how to approach my assignments. Then when I leave the office, and voila! Here comes an idea! In moments like these my greatest concern is to keep that idea in my memory long enough so that I can bring it back to work the following morning. Countless useful concepts have been born in this way.

**Can you provide a few words of advice to people who might in the future become C3D Labs staff members?**

There are people on this earth who seek a quiet life, full of stability and predictability. They learn a trade once, and then practice it for the rest of their lives.

But there are others who are thrill-seekers, such as those drawn to flights to Mars, conquering Mt. Everest, and so on. This is the type of person who should feel free to join our team and contribute to the development of C3D Labs solutions. All the tasks we engage in are entirely unique. If you want to test yourself, you are welcome to join us; we have plenty of exciting problems just waiting to be solved!

## WHAT IS C3D?

Read more about the C3D Toolkit at c3dlabs.com/en/products/c3d-kernel/

К списку новостей |