Jump to content

Roof Modelling difficulty


Recommended Posts

Hi tmac,

you can move the internal point of a triangle to the border by applying the average position of its two other points to it:

image.png.3690c55965b304217c895240c47dbe49.png image.png.9015d8b6bbb6517b4bf45dee50765969.pngimage.png.6b0a5101fc0ee4d764aad4818588abb7.png

// in a primitive wrangle
if(primvertexcount(0, i@primnum) == 3){ // make sure it's a triangle
    int pts[] = primpoints(0, i@primnum); // collect all points of the triangle
    vector pos = 0.0; // set a initial position value for summing up the other two points positions later
    int pt_move = -1; // set a initial point number for the yet unknown inner point
    foreach(int pt; pts){ // run over all points of this triangle
        if(inpointgroup(0, 'outer', pt) == 1){ // ask whether this point is part of the outer group
            pos += point(0, 'P', pt); // add its position to the position sum from line 3
        else{ // if the currently processed point is not part of the outer border..
            pt_move = pt; // .. define it as the inner point thats supposed to be moved..
    vector pos_avg = pos / 2.0; // .. to the average position of the other two points.
    setpointattrib(0, 'P', pt_move, pos_avg, 'set'); // apply the new position to the inner point.

Rising the roof can be done without promoting the polyframe`s egdedist attribute, simply by calling the vertex attribute within a point wrangle:

v@P.y += vertex(0, 'edgedist', i@vtxnum);



  • Like 2
  • Thanks 2
Link to comment
Share on other sites

Never mind, you can check if the point has three neighbors, otherwise it does not move the point.

if(primvertexcount(0, i@primnum) == 3){
    int pts[] = primpoints(0, i@primnum);
    vector pos = 0.0;
    int pt_move = -1;
    foreach(int pt; pts){
        if(inpointgroup(0, 'outer', pt) == 1){
            pos += point(0, 'P', pt);
            pt_move = pt;
    if( neighbourcount(0, pt_move) == 3){
        vector pos_avg = pos * chf('shape');
        setpointattrib(0, 'P', pt_move, pos_avg, 'set');


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...