Version 0.64.1

biselect_mod

Manipulates two areas of one solid simultaneously.

Signatures

  •   biselect_mod( solid s, selection sel1, modifier mod1, selection sel2, modifier mod2 )

Details

The biselect_mod function allows to apply two independent modifiers onto two selection areas sel1 and sel2 on a solid at the same time. There are two main modes of operation:

Disjoint Selections with Elastic Region:
If sel1 and sel2 are disjoint and do not cover the whole solid, the region outside both selections is elastically interpolated to smoothly connect the modified areas, avoiding kinks at the selection boundaries.

One Selection Covers the Whole Solid (No Elastic Region):
If sel2 covers the entire solid (e.g. using s.min_bbox()), and its modifier is identity, then only the region selected by sel1 is modified, and the rest of the solid remains unchanged. In this case, there is no elastic region and the transition between modified and unmodified regions may be sharp, possibly resulting in visible kinks.

Note

If sel2 covers the whole solid and its modifier is identity(), only the region selected by sel1 is modified, and the transition may be sharp (without elastic smoothing).

Example

 solid object = mesh( "myfiles/figure.stl" )
 selection s1 = selectbox( -11.0, 1.9, -3.0, 10.0, -5.0, 20.0 )
 selection s2 = selectsphere( 1.0, <[ 6.5, 1.7, 8.5 ]> )
 vector center = <[ 3.4, 2.3, 9.8 ]>
 vector axis = <[ 0.05, -0.98, 0.20 ]>
 make biselect_mod( object, s1, identity(), s2, rotation( center, axis, rad( 64.0 ) ) )
 

The left image shows two selections (green and red areas) that are applied onto a solid. The image on the right shows the result on rotating the red selection around the shown axis (big arrow). It can be seen how the part of the solid that are not covered by any of the selections is elastically adapted to follow the change.

Example

 // A simple cylinder
 float radius = 0.5
 float height = 10.0
 solid cyl = subdiv( 0.25, <[0.0, 0.0, 1.0]> ) >> cylinder( height, radius )

 // Select upper half of the cylinder
 selectbox top( -radius, radius, -radius, radius, height * 0.5, height )

 // Use biselect_mod() to bend the upper half of the cylinder
 make biselect_mod(
       cyl,
       top,
       bending( 2.0, <[1.0, 0.0]>, <[0.0, 0.0, height * 0.5]>, <[0.0, 0.0, 1.0]> ),
       cyl.min_bbox(),
       identity() )
 

Note

The biselect_mod function is not in its final phase yet and one might still encounter certain unexpected behavior.

Return value

A solid that is the modified version of s.

Parameters

s

The solid that gets modified.

sel1

The first selection. This can (but does not need to) contain parts of s.

mod1

A transformation modifier that is applied onto the solid area covered by sel1.

sel2

The second selection. This can (but does not need to) contain parts of s. It can also cover sel1 in parts or in total.

mod2

A transformation modifier that is applied onto the solid area covered by sel2.

See also

🗙

Search results for