Merge remote-tracking branch 'remotes/origin/master' into vb_treesupports

This commit is contained in:
Vojtech Bubnik 2022-11-28 10:07:39 +01:00
commit 25da414f5c
29 changed files with 603 additions and 179 deletions

View File

@ -1,11 +1,15 @@
min_slic3r_version = 2.5.0-alpha0
1.5.4 Added material profiles for Prusament Resin BioBased60.
1.5.3 Added filament profiles for ColorFabb VarioShore TPU, FormFutura PP, NinjaTek NinjaFlex/Cheetah TPU and for multiple Eolas Prints filaments. Updated bridging settings in 50um and 70um profiles.
1.5.2 Added SLA material profiles.
1.5.1 Renamed filament type "NYLON" to "PA". Updated Adura X profile. Updated PETG fan settings for Prusa MINI (removed fan ramp up).
1.5.0 Updated arachne parameters. Added profiles for Jessie filaments.
1.5.0-alpha1 Added filament profile for Prusament PA11 Carbon Fiber. Added profiles for multiple 3D-Fuel filaments.
1.5.0-alpha0 Added parameters for Arachne perimeter generator. Changed default seam position. Updated output filename format.
min_slic3r_version = 2.4.0-rc
1.4.8 Added filament and SLA material profiles. Updated settings.
1.4.7 Added filament profile for Prusament PA11 Carbon Fiber. Added profiles for multiple 3D-Fuel filaments.
1.4.6 Added SLA materials. Updated filament profiles.
1.4.6 Added SLA materials. Updated filament profiles.
1.4.5 Added MMU2/S profiles for 0.25mm nozzle. Updated FW version. Enabled g-code thumbnails for MK3 family printers. Updated end g-code.
1.4.4 Added multiple Fiberlogy filament profiles. Updated Extrudr filament profiles.
1.4.3 Added new filament profiles and SLA materials.

View File

@ -5,7 +5,7 @@
name = Prusa Research
# Configuration version of this file. Config file will only be installed, if the config_version differs.
# This means, the server may force the PrusaSlicer configuration to be downgraded.
config_version = 1.5.1
config_version = 1.5.4
# Where to get the updates from?
config_update_url = https://files.prusa3d.com/wp-content/uploads/repository/PrusaSlicer-settings-master/live/PrusaResearch/
changelog_url = https://files.prusa3d.com/?latest=slicer-profiles&lng=%1%
@ -441,8 +441,8 @@ inherits = *common*
layer_height = 0.05
bottom_solid_layers = 10
bridge_acceleration = 300
bridge_flow_ratio = 1.15
bridge_speed = 15
bridge_flow_ratio = 0.6
bridge_speed = 25
default_acceleration = 1000
external_perimeter_speed = 20
fill_density = 20%
@ -463,12 +463,13 @@ perimeters = 3
support_material_speed = 30
top_solid_infill_speed = 20
top_solid_layers = 15
thick_bridges = 1
[print:*0.07mm*]
inherits = *0.05mm*
layer_height = 0.07
bottom_solid_layers = 8
bridge_flow_ratio = 1
bridge_flow_ratio = 0.6
fill_density = 15%
infill_speed = 40
solid_infill_speed = 40
@ -583,6 +584,8 @@ top_solid_layers = 4
inherits = *0.05mm*
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2.*/ and nozzle_diameter[0]==0.4 and num_extruders==1
infill_extrusion_width = 0.5
support_material_contact_distance = 0.1
raft_contact_distance = 0.1
[print:0.10mm DETAIL]
inherits = *0.10mm*
@ -892,12 +895,16 @@ fill_pattern = gyroid
fill_density = 15%
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK3.*/ and nozzle_diameter[0]==0.4 and ! single_extruder_multi_material
top_infill_extrusion_width = 0.4
support_material_contact_distance = 0.1
raft_contact_distance = 0.1
[print:0.07mm ULTRADETAIL @MK3]
inherits = *0.07mm*; *MK3*
fill_pattern = gyroid
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK3.*/ and nozzle_diameter[0]==0.4 and ! single_extruder_multi_material
top_infill_extrusion_width = 0.4
support_material_contact_distance = 0.1
raft_contact_distance = 0.1
[print:0.10mm DETAIL @MK3]
inherits = *0.10mm*; *MK3*
@ -1269,6 +1276,8 @@ support_material_xy_spacing = 60%
support_material_speed = 30
support_material_extrusion_width = 0.35
bridge_acceleration = 300
support_material_contact_distance = 0.1
raft_contact_distance = 0.1
[print:0.07mm ULTRADETAIL @MINI]
inherits = *0.07mm*; *MINI*
@ -1282,6 +1291,8 @@ external_perimeter_extrusion_width = 0.4
support_material_xy_spacing = 60%
support_material_extrusion_width = 0.35
bridge_acceleration = 300
support_material_contact_distance = 0.1
raft_contact_distance = 0.1
[print:0.10mm DETAIL @MINI]
inherits = *0.10mm*; *MINI*
@ -1652,7 +1663,7 @@ filament_retract_length = 4
filament_retract_speed = 40
filament_deretract_speed = 15
filament_retract_lift = 0
filament_retract_before_travel = 7
filament_retract_before_travel = 6
filament_wipe = 0
bridge_fan_speed = 80
fan_always_on = 1
@ -2879,6 +2890,55 @@ min_print_speed = 15
slowdown_below_layer_time = 10
cooling = 1
[filament:NinjaTek NinjaFlex TPU]
inherits = *FLEX*
filament_vendor = NinjaTek
fan_always_on = 1
filament_max_volumetric_speed = 1.2
extrusion_multiplier = 1.2
first_layer_temperature = 238
first_layer_bed_temperature = 50
temperature = 238
bed_temperature = 50
bridge_fan_speed = 75
max_fan_speed = 60
min_fan_speed = 60
filament_retract_before_travel = 3
filament_cost = 85
filament_density = 1.19
filament_retract_length = 2.5
filament_retract_speed = 60
filament_deretract_speed = 25
filament_retract_lift = 0
filament_wipe = 0
disable_fan_first_layers = 1
full_fan_speed_layer = 3
min_print_speed = 10
slowdown_below_layer_time = 10
cooling = 1
[filament:NinjaTek Cheetah TPU]
inherits = NinjaTek NinjaFlex TPU
filament_retract_length = 1.5
filament_density = 1.22
filament_max_volumetric_speed = 4
extrusion_multiplier = 1.05
filament_retract_speed = 45
filament_deretract_speed = 25
first_layer_temperature = 240
temperature = 240
[filament:NinjaTek Cheetah TPU @MINI]
inherits = NinjaTek NinjaFlex TPU; *FLEXMINI*
filament_density = 1.22
filament_max_volumetric_speed = 3.5
extrusion_multiplier = 1.05
first_layer_temperature = 240
temperature = 240
filament_retract_speed = 50
filament_deretract_speed = 25
filament_retract_length = 4.8
[filament:Filatech FilaFlex40]
inherits = *FLEX*
filament_vendor = Filatech
@ -3174,7 +3234,8 @@ filament_retract_layer_change = nil
inherits = Ultrafuse ABS
filament_density = 1.08
first_layer_bed_temperature = 105
temperature = 250
first_layer_temperature = 270
temperature = 270
filament_colour = #FFF8D9
filament_notes = "Material Description\nABS Fusion+ made with Polyscope XILOY™ 3D is an engineering filament which has been optimized for 3D-printing. This special grade has been developed in collaboration with Polyscope Polymers - renowned for its material solutions in the automotive industry. ABS is a thermoplastic which is used in many applications. Although ABS has been classified as a standard material in 3D-printing it is known to be quite challenging to process. ABS Fusion+ combines the properties of ABS with an improved processability. The filament is based on an ABS grade which can be directly printed on glass without any adhesives or tape and has a higher success rate of prints due to extreme low warping."
filament_retract_before_travel = 2
@ -3943,6 +4004,76 @@ filament_density = 1.24
filament_spool_weight = 230
compatible_printers_condition = nozzle_diameter[0]!=0.8 and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material)
[filament:Eolas Prints PLA]
inherits = *PLA*
filament_vendor = Eolas Prints
filament_cost = 23.50
filament_density = 1.24
filament_spool_weight = 0
filament_colour = #4D9398
filament_max_volumetric_speed = 15
temperature = 208
[filament:Eolas Prints PLA Matte]
inherits = Eolas Prints PLA
filament_cost = 25.50
filament_max_volumetric_speed = 14
temperature = 212
[filament:Eolas Prints INGEO 850]
inherits = Eolas Prints PLA
filament_cost = 25.90
temperature = 210
[filament:Eolas Prints INGEO 870]
inherits = Eolas Prints PLA
filament_cost = 25.90
temperature = 215
first_layer_bed_temperature = 68
first_layer_temperature = 220
bed_temperature = 65
[filament:Eolas Prints PETG]
inherits = *PET*
filament_vendor = Eolas Prints
filament_cost = 29.90
filament_density = 1.27
filament_spool_weight = 0
filament_colour = #4D9398
filament_max_volumetric_speed = 8
temperature = 240
first_layer_bed_temperature = 85
first_layer_temperature = 235
bed_temperature = 90
filament_retract_length = 1.1
filament_retract_lift = 0.22
[filament:Eolas Prints PETG @MINI]
inherits = Eolas Prints PETG; *PETMINI*
[filament:Eolas Prints PETG - UV Resistant]
inherits = Eolas Prints PETG
filament_cost = 35.90
temperature = 237
first_layer_temperature = 232
[filament:Eolas Prints PETG - UV Resistant @MINI]
inherits = Eolas Prints PETG - UV Resistant; *PETMINI*
[filament:Eolas Prints TPU 93A]
inherits = *FLEX*
filament_vendor = Eolas Prints
filament_cost = 34.99
filament_density = 1.21
filament_spool_weight = 1000
filament_colour = #4D9398
filament_max_volumetric_speed = 1.2
temperature = 235
first_layer_bed_temperature = 30
bed_temperature = 30
filament_retract_length = 0
extrusion_multiplier = 1.16
[filament:Fiberlogy Easy PLA]
inherits = *PLA*
renamed_from = Fiberlogy PLA
@ -4041,22 +4172,19 @@ disable_fan_first_layers = 5
[filament:Fiberlogy PCTG]
inherits = Fiberlogy CPE HT
filament_vendor = Fiberlogy
filament_cost = 29.41
filament_density = 1.23
extrusion_multiplier = 0.98
min_fan_speed = 10
max_fan_speed = 15
bridge_fan_speed = 50
min_print_speed = 15
first_layer_temperature = 265
temperature = 265
first_layer_bed_temperature = 90
bed_temperature = 90
filament_type = CPE
fan_below_layer_time = 20
slowdown_below_layer_time = 15
disable_fan_first_layers = 5
filament_type = PCTG
[filament:Fiberlogy PCTG @MINI]
inherits = Fiberlogy PCTG; *PETMINI*
[filament:Fiberlogy FiberFlex 40D]
inherits = *FLEX*
@ -4331,7 +4459,7 @@ filament_loading_speed_start = 19
filament_minimal_purge_on_wipe_tower = 15
filament_unloading_speed_start = 100
full_fan_speed_layer = 4
filament_max_volumetric_speed = 13
filament_max_volumetric_speed = 12
[filament:Generic PLA @MMU2]
inherits = *PLA MMU2*
@ -4350,6 +4478,13 @@ filament_cost = 36.29
filament_density = 1.24
filament_spool_weight = 201
[filament:Jessie PLA @MMU2]
inherits = *PLA MMU2*
filament_vendor = Printed Solid
filament_cost = 21
filament_density = 1.24
filament_max_volumetric_speed = 10
[filament:Prusament PVB @MMU2]
inherits = *PLA MMU2*
filament_vendor = Prusa Polymers
@ -4402,6 +4537,17 @@ full_fan_speed_layer = 6
filament_retract_length = 1.2
filament_deretract_speed = 20
[filament:ColorFabb VarioShore TPU]
inherits = Fillamentum Flexfill 98A
filament_vendor = ColorFabb
filament_colour = #BBBBBB
filament_cost = 71.35
filament_density = 1.22
filament_spool_weight = 0
extrusion_multiplier = 0.85
first_layer_temperature = 220
temperature = 220
[filament:Taulman Bridge]
inherits = *common*
filament_vendor = Taulman
@ -4653,6 +4799,42 @@ min_fan_speed = 100
start_filament_gcode = "M900 K0 ; Filament gcode"
temperature = 220
[filament:FormFutura Centaur PP]
inherits = *common*
filament_vendor = FormFutura
filament_cost = 70
filament_density = 0.89
filament_spool_weight = 212
bridge_fan_speed = 100
cooling = 1
disable_fan_first_layers = 2
extrusion_multiplier = 1.05
fan_always_on = 1
fan_below_layer_time = 100
filament_colour = #DEE0E6
filament_max_volumetric_speed = 4
filament_type = PP
first_layer_bed_temperature = 85
bed_temperature = 85
first_layer_temperature = 235
max_fan_speed = 70
min_fan_speed = 70
start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_MODEL_MINI.*/ and nozzle_diameter[0]==0.6}0.12{elsif printer_notes=~/.*PRINTER_MODEL_MINI.*/ and nozzle_diameter[0]==0.8}0.06{elsif printer_notes=~/.*PRINTER_MODEL_MINI.*/}0.2{elsif nozzle_diameter[0]==0.8}0.02{elsif nozzle_diameter[0]==0.6}0.05{else}0.1{endif} ; Filament gcode LA 1.5\n{if printer_notes=~/.*PRINTER_MODEL_MINI.*/};{elsif printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}M900 K200{elsif nozzle_diameter[0]==0.6}M900 K28{elsif nozzle_diameter[0]==0.8};{else}M900 K48{endif} ; Filament gcode LA 1.0"
temperature = 235
filament_wipe = 0
filament_retract_lift = 0
compatible_printers_condition = nozzle_diameter[0]>=0.35 and printer_model!="MINI" and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material)
[filament:FormFutura Centaur PP @MINI]
inherits = FormFutura Centaur PP
filament_max_volumetric_speed = 3
filament_retract_length = 3.5
filament_retract_speed = 45
filament_deretract_speed = 20
filament_retract_lift = 0
filament_retract_before_travel = 4
compatible_printers_condition = nozzle_diameter[0]>=0.35 and printer_model=="MINI"
## Filaments MMU1
[filament:ColorFabb HT @MMU1]
@ -5775,6 +5957,30 @@ material_type = Tough
material_vendor = Prusa Polymers
material_colour = #FCB30E
[sla_material:Prusament Resin BioBased60 Herbal Green @0.025]
inherits = *common 0.025*
exposure_time = 7
initial_exposure_time = 30
material_type = Tough
material_vendor = Prusa Polymers
material_colour = #3AD200
[sla_material:Prusament Resin BioBased60 Magma Red @0.025]
inherits = *common 0.025*
exposure_time = 7
initial_exposure_time = 35
material_type = Tough
material_vendor = Prusa Polymers
material_colour = #D20202
[sla_material:Prusament Resin BioBased60 Natural Yellow @0.025]
inherits = *common 0.025*
exposure_time = 6
initial_exposure_time = 35
material_type = Tough
material_vendor = Prusa Polymers
material_colour = #ECDE05
## Prusa 0.025
[sla_material:Prusa Orange Tough @0.025]
@ -6732,6 +6938,30 @@ material_type = Tough
material_vendor = Prusa Polymers
material_colour = #FCB30E
[sla_material:Prusament Resin BioBased60 Herbal Green @0.05]
inherits = *common 0.05*
exposure_time = 8
initial_exposure_time = 30
material_type = Tough
material_vendor = Prusa Polymers
material_colour = #3AD200
[sla_material:Prusament Resin BioBased60 Magma Red @0.05]
inherits = *common 0.05*
exposure_time = 8
initial_exposure_time = 35
material_type = Tough
material_vendor = Prusa Polymers
material_colour = #D20202
[sla_material:Prusament Resin BioBased60 Natural Yellow @0.05]
inherits = *common 0.05*
exposure_time = 7
initial_exposure_time = 35
material_type = Tough
material_vendor = Prusa Polymers
material_colour = #ECDE05
## Prusa 0.05
[sla_material:Prusa Beige Tough @0.05]
@ -7120,6 +7350,30 @@ material_type = Tough
material_vendor = Prusa Polymers
material_colour = #FCB30E
[sla_material:Prusament Resin BioBased60 Herbal Green @0.1]
inherits = *common 0.1*
exposure_time = 13
initial_exposure_time = 45
material_type = Tough
material_vendor = Prusa Polymers
material_colour = #3AD200
[sla_material:Prusament Resin BioBased60 Magma Red @0.1]
inherits = *common 0.1*
exposure_time = 13
initial_exposure_time = 45
material_type = Tough
material_vendor = Prusa Polymers
material_colour = #D20202
[sla_material:Prusament Resin BioBased60 Natural Yellow @0.1]
inherits = *common 0.1*
exposure_time = 8
initial_exposure_time = 35
material_type = Tough
material_vendor = Prusa Polymers
material_colour = #ECDE05
## Prusa 0.1
[sla_material:Prusa Orange Tough @0.1]
@ -7336,6 +7590,31 @@ material_type = Tough
material_vendor = Prusa Polymers
material_colour = #FCB30E
[sla_material:Prusament Resin BioBased60 Herbal Green @0.025 SL1S]
inherits = *0.025_sl1s*
exposure_time = 3.5
initial_exposure_time = 30
material_type = Tough
material_vendor = Prusa Polymers
material_colour = #3AD200
[sla_material:Prusament Resin BioBased60 Magma Red @0.025 SL1S]
inherits = *0.025_sl1s*
exposure_time = 3.5
initial_exposure_time = 30
material_type = Tough
material_vendor = Prusa Polymers
material_colour = #D20202
[sla_material:Prusament Resin BioBased60 Natural Yellow @0.025 SL1S]
inherits = *0.025_sl1s*
exposure_time = 2.8
initial_exposure_time = 30
material_type = Tough
material_vendor = Prusa Polymers
material_colour = #ECDE05
material_print_speed = slow
## Made for Prusa 0.025
[sla_material:Prusa Orange Tough @0.025 SL1S]
@ -7531,6 +7810,15 @@ material_type = Flexible
material_vendor = BASF
material_colour = #595959
[sla_material:BlueCast X-One @0.025 SL1S]
inherits = *0.025_sl1s*
exposure_time = 6
initial_exposure_time = 25
material_type = Casting
material_vendor = BlueCast
material_colour = #C0C0C0
material_print_speed = slow
[sla_material:PrimaCreator Tough Light Grey @0.025 SL1S]
inherits = *0.025_sl1s*
exposure_time = 1.8
@ -7754,6 +8042,31 @@ material_type = Tough
material_vendor = Prusa Polymers
material_colour = #FCB30E
[sla_material:Prusament Resin BioBased60 Herbal Green @0.05 SL1S]
inherits = *0.05_sl1s*
exposure_time = 4
initial_exposure_time = 30
material_type = Tough
material_vendor = Prusa Polymers
material_colour = #3AD200
[sla_material:Prusament Resin BioBased60 Magma Red @0.05 SL1S]
inherits = *0.05_sl1s*
exposure_time = 4
initial_exposure_time = 30
material_type = Tough
material_vendor = Prusa Polymers
material_colour = #D20202
[sla_material:Prusament Resin BioBased60 Natural Yellow @0.05 SL1S]
inherits = *0.05_sl1s*
exposure_time = 3
initial_exposure_time = 30
material_type = Tough
material_vendor = Prusa Polymers
material_colour = #ECDE05
material_print_speed = slow
## Made for Prusa 0.05
[sla_material:Prusa Orange Tough @0.05 SL1S]
@ -8128,6 +8441,15 @@ material_type = Tough
material_vendor = BlueCast
material_colour = #007EFD
[sla_material:BlueCast X-One @0.05 SL1S]
inherits = *0.05_sl1s*
exposure_time = 7
initial_exposure_time = 25
material_type = Casting
material_vendor = BlueCast
material_colour = #C0C0C0
material_print_speed = slow
[sla_material:NextDent Model 2.0 Grey @0.05 SL1S]
inherits = *0.05_sl1s*
exposure_time = 4
@ -8476,6 +8798,31 @@ material_type = Tough
material_vendor = Prusa Polymers
material_colour = #FCB30E
[sla_material:Prusament Resin BioBased60 Herbal Green @0.1 SL1S]
inherits = *0.1_sl1s*
exposure_time = 5
initial_exposure_time = 30
material_type = Tough
material_vendor = Prusa Polymers
material_colour = #3AD200
[sla_material:Prusament Resin BioBased60 Magma Red @0.1 SL1S]
inherits = *0.1_sl1s*
exposure_time = 5
initial_exposure_time = 30
material_type = Tough
material_vendor = Prusa Polymers
material_colour = #D20202
[sla_material:Prusament Resin BioBased60 Natural Yellow @0.1 SL1S]
inherits = *0.1_sl1s*
exposure_time = 4
initial_exposure_time = 30
material_type = Tough
material_vendor = Prusa Polymers
material_colour = #ECDE05
material_print_speed = slow
## Made for Prusa 0.1
[sla_material:Prusa Orange Tough @0.1 SL1S]
@ -8671,6 +9018,15 @@ material_type = Flexible
material_vendor = BASF
material_colour = #595959
[sla_material:BlueCast X-One @0.1 SL1S]
inherits = *0.1_sl1s*
exposure_time = 8.5
initial_exposure_time = 25
material_type = Casting
material_vendor = BlueCast
material_colour = #C0C0C0
material_print_speed = slow
[sla_material:PrimaCreator Tough Light Grey @0.1 SL1S]
inherits = *0.1_sl1s*
exposure_time = 3

View File

@ -427,7 +427,7 @@ int CLI::run(int argc, char **argv)
}
#else
// model.objects.front()->cut(0, m_config.opt_float("cut"), ModelObjectCutAttribute::KeepLower | ModelObjectCutAttribute::KeepUpper | ModelObjectCutAttribute::FlipLower);
model.objects.front()->cut(0, Geometry::assemble_transform(m_config.opt_float("cut")* Vec3d::UnitZ()),
model.objects.front()->cut(0, Geometry::translation_transform(m_config.opt_float("cut") * Vec3d::UnitZ()),
ModelObjectCutAttribute::KeepLower | ModelObjectCutAttribute::KeepUpper | ModelObjectCutAttribute::PlaceOnCutUpper);
#endif
model.delete_object(size_t(0));

View File

@ -398,7 +398,7 @@ Vec3d extract_rotation(const Transform3d& transform)
#if ENABLE_WORLD_COORDINATE
Transform3d Transformation::get_offset_matrix() const
{
return assemble_transform(get_offset());
return translation_transform(get_offset());
}
static Transform3d extract_rotation_matrix(const Transform3d& trafo)

View File

@ -436,6 +436,8 @@ public:
const Vec3d& get_rotation() const { return m_rotation; }
double get_rotation(Axis axis) const { return m_rotation(axis); }
Transform3d get_rotation_matrix() const { return rotation_transform(get_rotation()); }
#endif // ENABLE_WORLD_COORDINATE
void set_rotation(const Vec3d& rotation);
@ -454,6 +456,8 @@ public:
#else
const Vec3d& get_scaling_factor() const { return m_scaling_factor; }
double get_scaling_factor(Axis axis) const { return m_scaling_factor(axis); }
Transform3d get_scaling_factor_matrix() const { return scale_transform(get_scaling_factor()); }
#endif // ENABLE_WORLD_COORDINATE
void set_scaling_factor(const Vec3d& scaling_factor);

View File

@ -25,6 +25,7 @@
namespace Slic3r {
// execute fn for each pixel on the line. If fn returns false, terminate the iteration
template<typename PointFn> void dda(coord_t x0, coord_t y0, coord_t x1, coord_t y1, const PointFn &fn)
{
coord_t dx = abs(x1 - x0);
@ -39,7 +40,7 @@ template<typename PointFn> void dda(coord_t x0, coord_t y0, coord_t x1, coord_t
dy *= 2;
for (; n > 0; --n) {
fn(x, y);
if (!fn(x, y)) return;
if (error > 0) {
x += x_inc;
@ -55,11 +56,11 @@ template<typename PointFn> void dda(coord_t x0, coord_t y0, coord_t x1, coord_t
// may call the fn on the same coordiantes multiple times!
template<typename PointFn> void double_dda_with_offset(coord_t x0, coord_t y0, coord_t x1, coord_t y1, const PointFn &fn)
{
Vec2d normal = Point{y1 - y0, x1 - x0}.cast<double>().normalized();
normal.x() = ceil(normal.x());
normal.y() = ceil(normal.y());
Point start_offset = Point(x0,y0) + (normal).cast<coord_t>();
Point end_offset = Point(x1,y1) + (normal).cast<coord_t>();
Vec2d normal = Point{y1 - y0, x1 - x0}.cast<double>().normalized();
normal.x() = ceil(normal.x());
normal.y() = ceil(normal.y());
Point start_offset = Point(x0, y0) + (normal).cast<coord_t>();
Point end_offset = Point(x1, y1) + (normal).cast<coord_t>();
dda(x0, y0, x1, y1, fn);
dda(start_offset.x(), start_offset.y(), end_offset.x(), end_offset.y(), fn);
@ -95,7 +96,7 @@ private:
bool is_jump_point(CellPositionType pos, CellPositionType forward_dir) const
{
if (abs(forward_dir.x()) + abs(forward_dir.y()) == 2) {
if (abs(forward_dir.x()) + abs(forward_dir.y()) == 2) {
// diagonal
CellPositionType horizontal_check_dir = CellPositionType{forward_dir.x(), 0};
CellPositionType vertical_check_dir = CellPositionType{0, forward_dir.y()};
@ -169,8 +170,11 @@ public:
float goal_heuristic(Node n) const { return n.position == target ? -1.f : (target - n.position).template cast<double>().norm(); }
size_t unique_id(Node n) const { return (static_cast<size_t>(uint16_t(n.position.x())) << 16) + static_cast<size_t>(uint16_t(n.position.y())); }
size_t unique_id(Node n) const
{
return (static_cast<size_t>(uint16_t(n.position.x())) << 16) + static_cast<size_t>(uint16_t(n.position.y()));
}
const std::vector<CellPositionType> all_directions{{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};
};
@ -189,6 +193,7 @@ void JPSPathFinder::add_obstacles(const Lines &obstacles)
obstacle_min.x() = std::min(obstacle_min.x(), x);
obstacle_min.y() = std::min(obstacle_min.y(), y);
inpassable.insert(Pixel{x, y});
return true;
};
for (const Line &l : obstacles) {
@ -200,36 +205,13 @@ void JPSPathFinder::add_obstacles(const Lines &obstacles)
void JPSPathFinder::add_obstacles(const Layer *layer, const Point &global_origin)
{
if (layer != nullptr) { this->print_z = layer->print_z; }
if (layer == nullptr) return;
auto store_obstacle = [&](coord_t x, coord_t y) {
obstacle_max.x() = std::max(obstacle_max.x(), x);
obstacle_max.y() = std::max(obstacle_max.y(), y);
obstacle_min.x() = std::min(obstacle_min.x(), x);
obstacle_min.y() = std::min(obstacle_min.y(), y);
inpassable.insert(Pixel{x, y});
};
this->print_z = layer->print_z;
Lines obstacles;
for (size_t step = 0; step < 3; step++) {
if (layer != nullptr) {
obstacles.insert(obstacles.end(), layer->malformed_lines.begin(), layer->malformed_lines.end());
layer = layer->lower_layer;
} else {
break;
}
}
for (const Line &l : obstacles) {
Pixel start = pixelize(l.a + global_origin);
Pixel end = pixelize(l.b + global_origin);
double_dda_with_offset(start.x(), start.y(), end.x(), end.y(), store_obstacle);
}
#ifdef DEBUG_FILES
::Slic3r::SVG svg(debug_out_path(("obstacles_jps" + std::to_string(print_z) + "_" + std::to_string(rand() % 1000)).c_str()).c_str(),
get_extents(obstacles));
svg.draw(obstacles);
svg.Close();
#endif
obstacles.reserve(layer->malformed_lines.size());
for (const Line &l : layer->malformed_lines) { obstacles.push_back(Line{l.a + global_origin, l.b + global_origin}); }
add_obstacles(obstacles);
}
Polyline JPSPathFinder::find_path(const Point &p0, const Point &p1)
@ -238,21 +220,40 @@ Polyline JPSPathFinder::find_path(const Point &p0, const Point &p1)
Pixel end = pixelize(p1);
if (inpassable.empty() || (start - end).cast<float>().norm() < 3.0) { return Polyline{p0, p1}; }
BoundingBox search_box({start,end,obstacle_max,obstacle_min});
search_box.max += Pixel(1,1);
search_box.min -= Pixel(1,1);
if (inpassable.find(start) != inpassable.end()) {
dda(start.x(), start.y(), end.x(), end.y(), [&](coord_t x, coord_t y) {
if (inpassable.find(Pixel(x, y)) == inpassable.end() || start == end) { // new start not found yet, and xy passable
start = Pixel(x, y);
return false;
}
return true;
});
}
if (inpassable.find(end) != inpassable.end()) {
dda(end.x(), end.y(), start.x(), start.y(), [&](coord_t x, coord_t y) {
if (inpassable.find(Pixel(x, y)) == inpassable.end() || start == end) { // new start not found yet, and xy passable
end = Pixel(x, y);
return false;
}
return true;
});
}
BoundingBox bounding_square(Points{start,end});
bounding_square.max += Pixel(5,5);
bounding_square.min -= Pixel(5,5);
coord_t bounding_square_size = 2*std::max(bounding_square.size().x(),bounding_square.size().y());
BoundingBox search_box({start, end, obstacle_max, obstacle_min});
search_box.max += Pixel(1, 1);
search_box.min -= Pixel(1, 1);
BoundingBox bounding_square(Points{start, end});
bounding_square.max += Pixel(5, 5);
bounding_square.min -= Pixel(5, 5);
coord_t bounding_square_size = 2 * std::max(bounding_square.size().x(), bounding_square.size().y());
bounding_square.max.x() += (bounding_square_size - bounding_square.size().x()) / 2;
bounding_square.min.x() -= (bounding_square_size - bounding_square.size().x()) / 2;
bounding_square.max.y() += (bounding_square_size - bounding_square.size().y()) / 2;
bounding_square.min.y() -= (bounding_square_size - bounding_square.size().y()) / 2;
// Intersection - limit the search box to a square area around the start and end, to fasten the path searching
// Intersection - limit the search box to a square area around the start and end, to fasten the path searching
search_box.max = search_box.max.cwiseMin(bounding_square.max);
search_box.min = search_box.min.cwiseMax(bounding_square.min);
@ -283,9 +284,7 @@ Polyline JPSPathFinder::find_path(const Point &p0, const Point &p1)
closest_qnode = astar_cache[closest_qnode].parent;
}
} else {
for (const auto& node : out_nodes) {
out_path.push_back(node.position);
}
for (const auto &node : out_nodes) { out_path.push_back(node.position); }
out_path.push_back(start);
}
@ -335,7 +334,11 @@ Polyline JPSPathFinder::find_path(const Point &p0, const Point &p1)
if (i - index_of_last_stored_point < 2) continue;
bool passable = true;
auto store_obstacle = [&](coord_t x, coord_t y) {
if (Pixel(x, y) != start && Pixel(x, y) != end && inpassable.find(Pixel(x, y)) != inpassable.end()) { passable = false; };
if (Pixel(x, y) != start && Pixel(x, y) != end && inpassable.find(Pixel(x, y)) != inpassable.end()) {
passable = false;
return false;
}
return true;
};
dda(tmp_path.back().x(), tmp_path.back().y(), out_path[i].x(), out_path[i].y(), store_obstacle);
if (!passable) {

View File

@ -1260,7 +1260,7 @@ void ModelObject::apply_cut_connectors(const std::string& new_name)
ModelVolume* new_volume = add_volume(std::move(mesh), ModelVolumeType::NEGATIVE_VOLUME);
// Transform the new modifier to be aligned inside the instance
new_volume->set_transformation(assemble_transform(connector.pos) * connector.rotation_m *
new_volume->set_transformation(translation_transform(connector.pos) * connector.rotation_m *
scale_transform(Vec3f(connector.radius, connector.radius, connector.height).cast<double>()));
new_volume->cut_info = { connector.attribs.type, connector.radius_tolerance, connector.height_tolerance };
@ -1437,7 +1437,7 @@ void ModelObject::process_solid_part_cut(ModelVolume* volume, const Transform3d&
using namespace Geometry;
const Transformation cut_transformation = Transformation(cut_matrix);
const Transform3d invert_cut_matrix = cut_transformation.get_rotation_matrix().inverse() * assemble_transform(-1 * cut_transformation.get_offset());
const Transform3d invert_cut_matrix = cut_transformation.get_rotation_matrix().inverse() * translation_transform(-1 * cut_transformation.get_offset());
// Transform the mesh by the combined transformation matrix.
// Flip the triangles in case the composite transformation is left handed.
@ -1505,7 +1505,7 @@ static void reset_instance_transformation(ModelObject* object, size_t src_instan
obj_instance->set_transformation(Transformation());
const Vec3d displace = local_displace.isApprox(Vec3d::Zero()) ? Vec3d::Zero() :
assemble_transform(Vec3d::Zero(), obj_instance->get_rotation()) * local_displace;
rotation_transform(obj_instance->get_rotation()) * local_displace;
obj_instance->set_offset(offset + displace);
Vec3d rotation = Vec3d::Zero();
@ -1560,15 +1560,19 @@ ModelObjectPtrs ModelObject::cut(size_t instance, const Transform3d& cut_matrix,
// in the transformation matrix and not applied to the mesh transform.
// const auto instance_matrix = instances[instance]->get_matrix(true);
#if ENABLE_WORLD_COORDINATE
const auto instance_matrix = instances[instance]->get_transformation().get_matrix_no_offset();
#else
const auto instance_matrix = assemble_transform(
Vec3d::Zero(), // don't apply offset
instances[instance]->get_rotation(),
instances[instance]->get_scaling_factor(),
instances[instance]->get_mirror()
);
#endif // ENABLE_WORLD_COORDINATE
const Transformation cut_transformation = Transformation(cut_matrix);
const Transform3d inverse_cut_matrix = cut_transformation.get_rotation_matrix().inverse() * assemble_transform(-1. * cut_transformation.get_offset());
const Transform3d inverse_cut_matrix = cut_transformation.get_rotation_matrix().inverse() * translation_transform(-1. * cut_transformation.get_offset());
// Displacement (in instance coordinates) to be applied to place the upper parts
Vec3d local_displace = Vec3d::Zero();
@ -2338,8 +2342,7 @@ arrangement::ArrangePolygon ModelInstance::get_arrange_polygon() const
Vec3d rotation = get_rotation();
rotation.z() = 0.;
Transform3d trafo_instance =
Geometry::assemble_transform(get_offset().z() * Vec3d::UnitZ(), rotation, get_scaling_factor(), get_mirror());
Transform3d trafo_instance = Geometry::assemble_transform(get_offset().z() * Vec3d::UnitZ(), rotation, get_scaling_factor(), get_mirror());
Polygon p = get_object()->convex_hull_2d(trafo_instance);

View File

@ -549,23 +549,21 @@ namespace boost { namespace polygon {
// Serialization through the Cereal library
namespace cereal {
// template<class Archive> void serialize(Archive& archive, Slic3r::Vec2crd &v) { archive(v.x(), v.y()); }
// template<class Archive> void serialize(Archive& archive, Slic3r::Vec3crd &v) { archive(v.x(), v.y(), v.z()); }
template<class Archive> void serialize(Archive& archive, Slic3r::Vec2i &v) { archive(v.x(), v.y()); }
template<class Archive> void serialize(Archive& archive, Slic3r::Vec3i &v) { archive(v.x(), v.y(), v.z()); }
// template<class Archive> void serialize(Archive& archive, Slic3r::Vec2i64 &v) { archive(v.x(), v.y()); }
// template<class Archive> void serialize(Archive& archive, Slic3r::Vec3i64 &v) { archive(v.x(), v.y(), v.z()); }
template<class Archive> void serialize(Archive& archive, Slic3r::Vec2f &v) { archive(v.x(), v.y()); }
template<class Archive> void serialize(Archive& archive, Slic3r::Vec3f &v) { archive(v.x(), v.y(), v.z()); }
template<class Archive> void serialize(Archive& archive, Slic3r::Vec2d &v) { archive(v.x(), v.y()); }
template<class Archive> void serialize(Archive& archive, Slic3r::Vec3d &v) { archive(v.x(), v.y(), v.z()); }
// template<class Archive> void serialize(Archive& archive, Slic3r::Vec2crd &v) { archive(v.x(), v.y()); }
// template<class Archive> void serialize(Archive& archive, Slic3r::Vec3crd &v) { archive(v.x(), v.y(), v.z()); }
template<class Archive> void serialize(Archive& archive, Slic3r::Vec2i &v) { archive(v.x(), v.y()); }
template<class Archive> void serialize(Archive& archive, Slic3r::Vec3i &v) { archive(v.x(), v.y(), v.z()); }
// template<class Archive> void serialize(Archive& archive, Slic3r::Vec2i64 &v) { archive(v.x(), v.y()); }
// template<class Archive> void serialize(Archive& archive, Slic3r::Vec3i64 &v) { archive(v.x(), v.y(), v.z()); }
template<class Archive> void serialize(Archive& archive, Slic3r::Vec2f &v) { archive(v.x(), v.y()); }
template<class Archive> void serialize(Archive& archive, Slic3r::Vec3f &v) { archive(v.x(), v.y(), v.z()); }
template<class Archive> void serialize(Archive& archive, Slic3r::Vec2d &v) { archive(v.x(), v.y()); }
template<class Archive> void serialize(Archive& archive, Slic3r::Vec3d &v) { archive(v.x(), v.y(), v.z()); }
template<class Archive> void load(Archive& archive, Slic3r::Matrix2f &m) { archive.loadBinary((char*)m.data(), sizeof(float) * 4); }
template<class Archive> void save(Archive& archive, Slic3r::Matrix2f &m) { archive.saveBinary((char*)m.data(), sizeof(float) * 4); }
#if ENABLE_WORLD_COORDINATE
template<class Archive> void load(Archive& archive, Slic3r::Matrix2f &m) { archive.loadBinary((char*)m.data(), sizeof(float) * 4); }
template<class Archive> void save(Archive& archive, Slic3r::Matrix2f &m) { archive.saveBinary((char*)m.data(), sizeof(float) * 4); }
template<class Archive> void load(Archive& archive, Slic3r::Transform3d& m) { archive.loadBinary((char*)m.data(), sizeof(double) * 16); }
template<class Archive> void save(Archive& archive, const Slic3r::Transform3d& m) { archive.saveBinary((char*)m.data(), sizeof(double) * 16); }
#endif // ENABLE_WORLD_COORDINATE
}
// To be able to use Vec<> and Mat<> in range based for loops:

View File

@ -58,7 +58,6 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
// Cache the plenty of parameters, which influence the G-code generator only,
// or they are only notes not influencing the generated G-code.
static std::unordered_set<std::string> steps_gcode = {
"avoid_curled_filament_during_travels",
"avoid_crossing_perimeters",
"avoid_crossing_perimeters_max_detour",
"bed_shape",
@ -223,6 +222,8 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
osteps.emplace_back(posInfill);
osteps.emplace_back(posSupportMaterial);
steps.emplace_back(psSkirtBrim);
} else if (opt_key == "avoid_curled_filament_during_travels") {
osteps.emplace_back(posEstimateCurledExtrusions);
} else {
// for legacy, if we can't handle this option let's invalidate all steps
//FIXME invalidate all steps of all objects as well?
@ -382,6 +383,16 @@ bool Print::sequential_print_horizontal_clearance_valid(const Print& print, Poly
// FIXME: Arrangement has different parameters for offsetting (jtMiter, limit 2)
// which causes that the warning will be showed after arrangement with the
// appropriate object distance. Even if I set this to jtMiter the warning still shows up.
#if ENABLE_WORLD_COORDINATE
Geometry::Transformation trafo = model_instance0->get_transformation();
trafo.set_offset({ 0.0, 0.0, model_instance0->get_offset().z() });
it_convex_hull = map_model_object_to_convex_hull.emplace_hint(it_convex_hull, model_object_id,
offset(print_object->model_object()->convex_hull_2d(trafo.get_matrix()),
// Shrink the extruder_clearance_radius a tiny bit, so that if the object arrangement algorithm placed the objects
// exactly by satisfying the extruder_clearance_radius, this test will not trigger collision.
float(scale_(0.5 * print.config().extruder_clearance_radius.value - BuildVolume::BedEpsilon)),
jtRound, scale_(0.1)).front());
#else
it_convex_hull = map_model_object_to_convex_hull.emplace_hint(it_convex_hull, model_object_id,
offset(print_object->model_object()->convex_hull_2d(
Geometry::assemble_transform({ 0.0, 0.0, model_instance0->get_offset().z() }, model_instance0->get_rotation(), model_instance0->get_scaling_factor(), model_instance0->get_mirror())),
@ -389,7 +400,8 @@ bool Print::sequential_print_horizontal_clearance_valid(const Print& print, Poly
// exactly by satisfying the extruder_clearance_radius, this test will not trigger collision.
float(scale_(0.5 * print.config().extruder_clearance_radius.value - BuildVolume::BedEpsilon)),
jtRound, scale_(0.1)).front());
}
#endif // ENABLE_WORLD_COORDINATE
}
// Make a copy, so it may be rotated for instances.
Polygon convex_hull0 = it_convex_hull->second;
const double z_diff = Geometry::rotation_diff_z(model_instance0->get_rotation(), print_object->instances().front().model_instance->get_rotation());

View File

@ -300,12 +300,17 @@ struct RotfinderBoilerplate {
TriangleMesh mesh = mo.raw_mesh();
ModelInstance *mi = mo.instances[0];
#if ENABLE_WORLD_COORDINATE
const Geometry::Transformation trafo = mi->get_transformation();
Transform3d trafo_instance = trafo.get_scaling_factor_matrix() * trafo.get_mirror_matrix();
#else
auto rotation = Vec3d::Zero();
auto offset = Vec3d::Zero();
Transform3d trafo_instance =
Geometry::assemble_transform(offset, rotation,
mi->get_scaling_factor(),
mi->get_mirror());
#endif // ENABLE_WORLD_COORDINATE
mesh.transform(trafo_instance);

View File

@ -818,7 +818,7 @@ void Bed3D::render_model()
#if ENABLE_RAYCAST_PICKING
// register for picking
register_raycasters_for_picking(m_model.model.get_geometry(), Geometry::assemble_transform(m_model_offset));
register_raycasters_for_picking(m_model.model.get_geometry(), Geometry::translation_transform(m_model_offset));
#endif // ENABLE_RAYCAST_PICKING
// update extended bounding box
@ -835,7 +835,7 @@ void Bed3D::render_model()
shader->start_using();
shader->set_uniform("emission_factor", 0.0f);
#if ENABLE_LEGACY_OPENGL_REMOVAL
const Transform3d model_matrix = Geometry::assemble_transform(m_model_offset);
const Transform3d model_matrix = Geometry::translation_transform(m_model_offset);
shader->set_uniform("view_model_matrix", view_matrix * model_matrix);
shader->set_uniform("projection_matrix", projection_matrix);
const Matrix3d view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * model_matrix.matrix().block(0, 0, 3, 3).inverse().transpose();

View File

@ -307,7 +307,7 @@ void GLVolume::SinkingContours::render()
return;
const GUI::Camera& camera = GUI::wxGetApp().plater()->get_camera();
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * Geometry::assemble_transform(m_shift));
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * Geometry::translation_transform(m_shift));
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
#else
glsafe(::glPushMatrix());

View File

@ -61,28 +61,28 @@ void CoordAxes::render(float emission_factor)
// x axis
#if ENABLE_LEGACY_OPENGL_REMOVAL
m_arrow.set_color(ColorRGBA::X());
render_axis(*shader, trafo * Geometry::assemble_transform(m_origin, { 0.0, 0.5 * M_PI, 0.0 }));
render_axis(*shader, trafo * Geometry::translation_transform(m_origin) * Geometry::rotation_transform({ 0.0, 0.5 * M_PI, 0.0 }));
#else
m_arrow.set_color(-1, ColorRGBA::X());
render_axis(Geometry::assemble_transform(m_origin, { 0.0, 0.5 * M_PI, 0.0 }).cast<float>());
render_axis(Geometry::translation_transform(m_origin) * Geometry::rotation_transform({ 0.0, 0.5 * M_PI, 0.0 }).cast<float>());
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
// y axis
#if ENABLE_LEGACY_OPENGL_REMOVAL
m_arrow.set_color(ColorRGBA::Y());
render_axis(*shader, trafo * Geometry::assemble_transform(m_origin, { -0.5 * M_PI, 0.0, 0.0 }));
render_axis(*shader, trafo * Geometry::translation_transform(m_origin) * Geometry::rotation_transform({ -0.5 * M_PI, 0.0, 0.0 }));
#else
m_arrow.set_color(-1, ColorRGBA::Y());
render_axis(Geometry::assemble_transform(m_origin, { -0.5 * M_PI, 0.0, 0.0 }).cast<float>());
render_axis(Geometry::translation_transform(m_origin) * Geometry::rotation_transform({ -0.5 * M_PI, 0.0, 0.0 }).cast<float>());
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
// z axis
#if ENABLE_LEGACY_OPENGL_REMOVAL
m_arrow.set_color(ColorRGBA::Z());
render_axis(*shader, trafo * Geometry::assemble_transform(m_origin));
render_axis(*shader, trafo * Geometry::translation_transform(m_origin));
#else
m_arrow.set_color(-1, ColorRGBA::Z());
render_axis(Geometry::assemble_transform(m_origin).cast<float>());
render_axis(Geometry::translation_transform(m_origin).cast<float>());
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
shader->stop_using();

View File

@ -743,9 +743,7 @@ boost::any& CheckBox::get_value()
void CheckBox::msw_rescale()
{
Field::msw_rescale();
wxCheckBox* field = dynamic_cast<wxCheckBox*>(window);
field->SetMinSize(wxSize(-1, int(1.5f*field->GetFont().GetPixelSize().y +0.5f)));
window->SetInitialSize(window->GetBestSize());
}

View File

@ -195,10 +195,10 @@ void GCodeViewer::COG::render()
#if ENABLE_LEGACY_OPENGL_REMOVAL
const Camera& camera = wxGetApp().plater()->get_camera();
Transform3d model_matrix = Geometry::assemble_transform(cog());
Transform3d model_matrix = Geometry::translation_transform(cog());
if (m_fixed_size) {
const double inv_zoom = camera.get_inv_zoom();
model_matrix = model_matrix * Geometry::assemble_transform(Vec3d::Zero(), Vec3d::Zero(), inv_zoom * Vec3d::Ones());
model_matrix = model_matrix * Geometry::scale_transform(inv_zoom);
}
const Transform3d& view_matrix = camera.get_view_matrix();
shader->set_uniform("view_model_matrix", view_matrix * model_matrix);
@ -315,7 +315,8 @@ void GCodeViewer::SequentialView::Marker::init()
void GCodeViewer::SequentialView::Marker::set_world_position(const Vec3f& position)
{
m_world_position = position;
m_world_transform = (Geometry::assemble_transform((position + m_z_offset * Vec3f::UnitZ()).cast<double>()) * Geometry::assemble_transform(m_model.get_bounding_box().size().z() * Vec3d::UnitZ(), { M_PI, 0.0, 0.0 })).cast<float>();
m_world_transform = (Geometry::translation_transform((position + m_z_offset * Vec3f::UnitZ()).cast<double>()) *
Geometry::translation_transform(m_model.get_bounding_box().size().z() * Vec3d::UnitZ()) * Geometry::rotation_transform({ M_PI, 0.0, 0.0 })).cast<float>();
}
void GCodeViewer::SequentialView::Marker::render()
@ -1550,7 +1551,8 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
const double width = static_cast<double>(1.5f * curr.width);
const double height = static_cast<double>(1.5f * curr.height);
const Transform3d trafo = Geometry::assemble_transform((curr.position - 0.5f * curr.height * Vec3f::UnitZ()).cast<double>(), Vec3d::Zero(), { width, width, height });
const Transform3d trafo = Geometry::translation_transform((curr.position - 0.5f * curr.height * Vec3f::UnitZ()).cast<double>()) *
Geometry::scale_transform({ width, width, height });
const Eigen::Matrix<double, 3, 3, Eigen::DontAlign> normal_matrix = trafo.matrix().template block<3, 3>(0, 0).inverse().transpose();
#if ENABLE_LEGACY_OPENGL_REMOVAL

View File

@ -4318,12 +4318,22 @@ void GLCanvas3D::update_sequential_clearance()
for (size_t i = 0; i < m_model->objects.size(); ++i) {
ModelObject* model_object = m_model->objects[i];
ModelInstance* model_instance0 = model_object->instances.front();
#if ENABLE_WORLD_COORDINATE
Geometry::Transformation trafo = model_instance0->get_transformation();
trafo.set_offset({ 0.0, 0.0, model_instance0->get_offset().z() });
Polygon hull_2d = offset(model_object->convex_hull_2d(trafo.get_matrix()),
// Shrink the extruder_clearance_radius a tiny bit, so that if the object arrangement algorithm placed the objects
// exactly by satisfying the extruder_clearance_radius, this test will not trigger collision.
shrink_factor,
jtRound, mitter_limit).front();
#else
Polygon hull_2d = offset(model_object->convex_hull_2d(Geometry::assemble_transform({ 0.0, 0.0, model_instance0->get_offset().z() }, model_instance0->get_rotation(),
model_instance0->get_scaling_factor(), model_instance0->get_mirror())),
// Shrink the extruder_clearance_radius a tiny bit, so that if the object arrangement algorithm placed the objects
// exactly by satisfying the extruder_clearance_radius, this test will not trigger collision.
shrink_factor,
jtRound, mitter_limit).front();
#endif // ENABLE_WORLD_COORDINATE
Pointf3s& cache_hull_2d = m_sequential_print_clearance.m_hull_2d_cache.emplace_back(Pointf3s());
cache_hull_2d.reserve(hull_2d.points.size());
@ -5682,6 +5692,7 @@ void GLCanvas3D::_rectangular_selection_picking_pass()
#if ENABLE_RAYCAST_PICKING
const Camera& main_camera = wxGetApp().plater()->get_camera();
Camera framebuffer_camera;
framebuffer_camera.set_type(main_camera.get_type());
const Camera* camera = &main_camera;
if (use_framebuffer) {
// setup a camera which covers only the selection rectangle
@ -6460,7 +6471,7 @@ void GLCanvas3D::_render_camera_target()
shader->start_using();
#if ENABLE_LEGACY_OPENGL_REMOVAL
const Camera& camera = wxGetApp().plater()->get_camera();
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * Geometry::assemble_transform(m_camera_target.target));
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * Geometry::translation_transform(m_camera_target.target));
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
#if ENABLE_GL_CORE_PROFILE
const std::array<int, 4>& viewport = camera.get_viewport();
@ -6648,10 +6659,18 @@ void GLCanvas3D::_render_sla_slices()
for (const SLAPrintObject::Instance& inst : obj->instances()) {
const Camera& camera = wxGetApp().plater()->get_camera();
#if ENABLE_WORLD_COORDINATE
Transform3d view_model_matrix = camera.get_view_matrix() *
Geometry::translation_transform({ unscale<double>(inst.shift.x()), unscale<double>(inst.shift.y()), 0.0 }) *
Geometry::rotation_transform(inst.rotation * Vec3d::UnitZ());
if (obj->is_left_handed())
view_model_matrix = view_model_matrix * Geometry::scale_transform({ -1.0f, 1.0f, 1.0f });
#else
const Transform3d view_model_matrix = camera.get_view_matrix() *
Geometry::assemble_transform(Vec3d(unscale<double>(inst.shift.x()), unscale<double>(inst.shift.y()), 0.0),
Geometry::assemble_transform(Vec3d(unscale<double>(inst.shift.x()), unscale<double>(inst.shift.y()), 0.0),
inst.rotation * Vec3d::UnitZ(), Vec3d::Ones(),
obj->is_left_handed() ? /* The polygons are mirrored by X */ Vec3d(-1.0f, 1.0f, 1.0f) : Vec3d::Ones());
#endif // ENABLE_WORLD_COORDINATE
shader->set_uniform("view_model_matrix", view_model_matrix);
shader->set_uniform("projection_matrix", camera.get_projection_matrix());

View File

@ -1409,7 +1409,7 @@ void ObjectManipulation::msw_rescale()
editor->msw_rescale();
// rescale "inches" checkbox
m_check_inch->SetMinSize(wxSize(-1, int(1.5f * m_check_inch->GetFont().GetPixelSize().y + 0.5f)));
m_check_inch->SetInitialSize(m_check_inch->GetBestSize());
get_og()->msw_rescale();
}

View File

@ -129,11 +129,11 @@ void GLGizmoBase::Grabber::render(float size, const ColorRGBA& render_color, boo
const Transform3d& view_matrix = camera.get_view_matrix();
const Matrix3d view_matrix_no_offset = view_matrix.matrix().block(0, 0, 3, 3);
std::vector<Transform3d> elements_matrices(GRABBER_ELEMENTS_MAX_COUNT, Transform3d::Identity());
elements_matrices[0] = matrix * Geometry::assemble_transform(center, angles, 2.0 * half_size * Vec3d::Ones());
elements_matrices[0] = matrix * Geometry::translation_transform(center) * Geometry::rotation_transform(angles) * Geometry::scale_transform(2.0 * half_size);
Transform3d view_model_matrix = view_matrix * elements_matrices[0];
#else
const Transform3d& view_matrix = camera.get_view_matrix();
const Transform3d model_matrix = matrix * Geometry::assemble_transform(center, angles, 2.0 * half_size * Vec3d::Ones());
const Transform3d model_matrix = matrix * Geometry::translation_transform(center) * Geometry::rotation_transform(angles) * Geometry::scale_transform(2.0 * half_size);
const Transform3d view_model_matrix = view_matrix * model_matrix;
#endif // ENABLE_RAYCAST_PICKING
@ -171,55 +171,55 @@ void GLGizmoBase::Grabber::render(float size, const ColorRGBA& render_color, boo
#if ENABLE_LEGACY_OPENGL_REMOVAL
if ((int(extensions) & int(GLGizmoBase::EGrabberExtension::PosX)) != 0) {
#if ENABLE_RAYCAST_PICKING
elements_matrices[1] = elements_matrices[0] * Geometry::assemble_transform(Vec3d::UnitX(), Vec3d(0.0, 0.5 * double(PI), 0.0));
elements_matrices[1] = elements_matrices[0] * Geometry::translation_transform(Vec3d::UnitX()) * Geometry::rotation_transform({ 0.0, 0.5 * double(PI), 0.0 });
render_extension(elements_matrices[1]);
#else
shader->set_uniform("view_model_matrix", view_model_matrix * Geometry::assemble_transform(Vec3d::UnitX(), Vec3d(0.0, 0.5 * double(PI), 0.0)));
shader->set_uniform("view_model_matrix", view_model_matrix * Geometry::translation_transform(Vec3d::UnitX()) * Geometry::rotation_transform({ 0.0, 0.5 * double(PI), 0.0 }));
s_cone.render();
#endif // ENABLE_RAYCAST_PICKING
}
if ((int(extensions) & int(GLGizmoBase::EGrabberExtension::NegX)) != 0) {
#if ENABLE_RAYCAST_PICKING
elements_matrices[2] = elements_matrices[0] * Geometry::assemble_transform(-Vec3d::UnitX(), Vec3d(0.0, -0.5 * double(PI), 0.0));
elements_matrices[2] = elements_matrices[0] * Geometry::translation_transform(-Vec3d::UnitX()) * Geometry::rotation_transform({ 0.0, -0.5 * double(PI), 0.0 });
render_extension(elements_matrices[2]);
#else
shader->set_uniform("view_model_matrix", view_model_matrix * Geometry::assemble_transform(-Vec3d::UnitX(), Vec3d(0.0, -0.5 * double(PI), 0.0)));
shader->set_uniform("view_model_matrix", view_model_matrix * Geometry::translation_transform(-Vec3d::UnitX()) * Geometry::rotation_transform({ 0.0, -0.5 * double(PI), 0.0 }));
s_cone.render();
#endif // ENABLE_RAYCAST_PICKING
}
if ((int(extensions) & int(GLGizmoBase::EGrabberExtension::PosY)) != 0) {
#if ENABLE_RAYCAST_PICKING
elements_matrices[3] = elements_matrices[0] * Geometry::assemble_transform(Vec3d::UnitY(), Vec3d(-0.5 * double(PI), 0.0, 0.0));
elements_matrices[3] = elements_matrices[0] * Geometry::translation_transform(Vec3d::UnitY()) * Geometry::rotation_transform({ -0.5 * double(PI), 0.0, 0.0 });
render_extension(elements_matrices[3]);
#else
shader->set_uniform("view_model_matrix", view_model_matrix * Geometry::assemble_transform(Vec3d::UnitY(), Vec3d(-0.5 * double(PI), 0.0, 0.0)));
shader->set_uniform("view_model_matrix", view_model_matrix * Geometry::translation_transform(Vec3d::UnitY()) * Geometry::rotation_transform({ -0.5 * double(PI), 0.0, 0.0 }));
s_cone.render();
#endif // ENABLE_RAYCAST_PICKING
}
if ((int(extensions) & int(GLGizmoBase::EGrabberExtension::NegY)) != 0) {
#if ENABLE_RAYCAST_PICKING
elements_matrices[4] = elements_matrices[0] * Geometry::assemble_transform(-Vec3d::UnitY(), Vec3d(0.5 * double(PI), 0.0, 0.0));
elements_matrices[4] = elements_matrices[0] * Geometry::translation_transform(-Vec3d::UnitY()) * Geometry::rotation_transform({ 0.5 * double(PI), 0.0, 0.0 });
render_extension(elements_matrices[4]);
#else
shader->set_uniform("view_model_matrix", view_model_matrix * Geometry::assemble_transform(-Vec3d::UnitY(), Vec3d(0.5 * double(PI), 0.0, 0.0)));
shader->set_uniform("view_model_matrix", view_model_matrix* Geometry::translation_transform(-Vec3d::UnitY())* Geometry::rotation_transform({ 0.5 * double(PI), 0.0, 0.0 }));
s_cone.render();
#endif // ENABLE_RAYCAST_PICKING
}
if ((int(extensions) & int(GLGizmoBase::EGrabberExtension::PosZ)) != 0) {
#if ENABLE_RAYCAST_PICKING
elements_matrices[5] = elements_matrices[0] * Geometry::assemble_transform(Vec3d::UnitZ());
elements_matrices[5] = elements_matrices[0] * Geometry::translation_transform(Vec3d::UnitZ());
render_extension(elements_matrices[5]);
#else
shader->set_uniform("view_model_matrix", view_model_matrix * Geometry::assemble_transform(Vec3d::UnitZ()));
shader->set_uniform("view_model_matrix", view_model_matrix* Geometry::translation_transform(Vec3d::UnitZ()));
s_cone.render();
#endif // ENABLE_RAYCAST_PICKING
}
if ((int(extensions) & int(GLGizmoBase::EGrabberExtension::NegZ)) != 0) {
#if ENABLE_RAYCAST_PICKING
elements_matrices[6] = elements_matrices[0] * Geometry::assemble_transform(-Vec3d::UnitZ(), Vec3d(double(PI), 0.0, 0.0));
render_extension(elements_matrices[6]);
elements_matrices[6] = elements_matrices[0] * Geometry::translation_transform(-Vec3d::UnitZ()) * Geometry::rotation_transform({ double(PI), 0.0, 0.0 });
render_extension(elements_matrices[6]);
#else
shader->set_uniform("view_model_matrix", view_model_matrix * Geometry::assemble_transform(-Vec3d::UnitZ(), Vec3d(double(PI), 0.0, 0.0)));
shader->set_uniform("view_model_matrix", view_model_matrix* Geometry::translation_transform(-Vec3d::UnitZ())* Geometry::rotation_transform({ double(PI), 0.0, 0.0 }));
s_cone.render();
#endif // ENABLE_RAYCAST_PICKING
}

View File

@ -337,7 +337,7 @@ void GLGizmoCut3D::shift_cut_z(double delta)
void GLGizmoCut3D::rotate_vec3d_around_plane_center(Vec3d&vec)
{
vec = Transformation( assemble_transform(m_plane_center) * m_rotation_m * assemble_transform(-m_plane_center)).get_matrix() * vec;
vec = Transformation(translation_transform(m_plane_center) * m_rotation_m * translation_transform(-m_plane_center)).get_matrix() * vec;
}
void GLGizmoCut3D::put_connectors_on_cut_plane(const Vec3d& cp_normal, double cp_offset)
@ -737,10 +737,10 @@ void GLGizmoCut3D::render_cut_plane_grabbers()
{
const BoundingBoxf3 tbb = transformed_bounding_box(m_plane_center);
if (tbb.min.z() <= 0.0)
render_model(m_cone.model, color, view_matrix * assemble_transform(-offset, PI * Vec3d::UnitX(), cone_scale));
render_model(m_cone.model, color, view_matrix * translation_transform(-offset) * rotation_transform(PI * Vec3d::UnitX()) * scale_transform(cone_scale));
if (tbb.max.z() >= 0.0)
render_model(m_cone.model, color, view_matrix * assemble_transform(offset, Vec3d::Zero(), cone_scale));
render_model(m_cone.model, color, view_matrix * translation_transform(offset) * scale_transform(cone_scale));
}
// render top sphere for X/Y grabbers
@ -750,7 +750,7 @@ void GLGizmoCut3D::render_cut_plane_grabbers()
size = m_dragging ? double(grabber.get_dragging_half_size(mean_size)) : double(grabber.get_half_size(mean_size));
color = m_hover_id == Y ? complementary(ColorRGBA::GREEN()) :
m_hover_id == X ? complementary(ColorRGBA::RED()) : ColorRGBA::GRAY();
render_model(m_sphere.model, color, view_matrix * assemble_transform(m_grabber_connection_len * Vec3d::UnitZ(), Vec3d::Zero(), size * Vec3d::Ones()));
render_model(m_sphere.model, color, view_matrix * translation_transform(m_grabber_connection_len * Vec3d::UnitZ()) * scale_transform(size));
}
// render X grabber
@ -767,9 +767,9 @@ void GLGizmoCut3D::render_cut_plane_grabbers()
}
offset = Vec3d(0.0, 1.25 * size, m_grabber_connection_len);
render_model(m_cone.model, color, view_matrix * assemble_transform(offset, -0.5 * PI * Vec3d::UnitX(), cone_scale));
render_model(m_cone.model, color, view_matrix * translation_transform(offset) * rotation_transform(-0.5 * PI * Vec3d::UnitX()) * scale_transform(cone_scale));
offset = Vec3d(0.0, -1.25 * size, m_grabber_connection_len);
render_model(m_cone.model, color, view_matrix * assemble_transform(offset, 0.5 * PI * Vec3d::UnitX(), cone_scale));
render_model(m_cone.model, color, view_matrix * translation_transform(offset) * rotation_transform(0.5 * PI * Vec3d::UnitX()) * scale_transform(cone_scale));
}
// render Y grabber
@ -786,9 +786,9 @@ void GLGizmoCut3D::render_cut_plane_grabbers()
}
offset = Vec3d(1.25 * size, 0.0, m_grabber_connection_len);
render_model(m_cone.model, color, view_matrix * assemble_transform(offset, 0.5 * PI * Vec3d::UnitY(), cone_scale));
render_model(m_cone.model, color, view_matrix * translation_transform(offset) * rotation_transform(0.5 * PI * Vec3d::UnitY()) * scale_transform(cone_scale));
offset = Vec3d(-1.25 * size, 0.0, m_grabber_connection_len);
render_model(m_cone.model, color, view_matrix * assemble_transform(offset, -0.5 * PI * Vec3d::UnitY(), cone_scale));
render_model(m_cone.model, color, view_matrix * translation_transform(offset)* rotation_transform(-0.5 * PI * Vec3d::UnitY()) * scale_transform(cone_scale));
}
}
@ -979,19 +979,19 @@ void GLGizmoCut3D::update_raycasters_for_picking_transform()
Vec3d scale = Vec3d(0.75 * size, 0.75 * size, 1.8 * size);
Vec3d offset = Vec3d(0.0, 1.25 * size, m_grabber_connection_len);
m_raycasters[0]->set_transform(trafo * assemble_transform(offset, -0.5 * PI * Vec3d::UnitX(), scale));
m_raycasters[0]->set_transform(trafo * translation_transform(offset) * rotation_transform(-0.5 * PI * Vec3d::UnitX()) * scale_transform(scale));
offset = Vec3d(0.0, -1.25 * size, m_grabber_connection_len);
m_raycasters[1]->set_transform(trafo * assemble_transform(offset, 0.5 * PI * Vec3d::UnitX(), scale));
m_raycasters[1]->set_transform(trafo * translation_transform(offset) * rotation_transform(0.5 * PI * Vec3d::UnitX()) * scale_transform(scale));
offset = Vec3d(1.25 * size, 0.0, m_grabber_connection_len);
m_raycasters[2]->set_transform(trafo * assemble_transform(offset, 0.5 * PI * Vec3d::UnitY(), scale));
m_raycasters[2]->set_transform(trafo * translation_transform(offset) * rotation_transform(0.5 * PI * Vec3d::UnitY()) * scale_transform(scale));
offset = Vec3d(-1.25 * size, 0.0, m_grabber_connection_len);
m_raycasters[3]->set_transform(trafo * assemble_transform(offset, -0.5 * PI * Vec3d::UnitY(), scale));
m_raycasters[3]->set_transform(trafo * translation_transform(offset) * rotation_transform(-0.5 * PI * Vec3d::UnitY()) * scale_transform(scale));
offset = 1.25 * size * Vec3d::UnitZ();
m_raycasters[4]->set_transform(trafo * scale_transform(size));
m_raycasters[5]->set_transform(trafo * assemble_transform(-offset, PI * Vec3d::UnitX(), scale));
m_raycasters[6]->set_transform(trafo * assemble_transform(offset, Vec3d::Zero(), scale));
m_raycasters[5]->set_transform(trafo * translation_transform(-offset) * rotation_transform(PI * Vec3d::UnitX()) * scale_transform(scale));
m_raycasters[6]->set_transform(trafo * translation_transform(offset) * scale_transform(scale));
}
}
@ -1245,8 +1245,8 @@ BoundingBoxf3 GLGizmoCut3D::transformed_bounding_box(const Vec3d& plane_center,
Vec3d cut_center_offset = plane_center - instance_offset;
cut_center_offset[Z] -= sel_info->get_sla_shift();
const auto move = assemble_transform(-cut_center_offset);
const auto move2 = assemble_transform(plane_center);
const auto move = translation_transform(-cut_center_offset);
const auto move2 = translation_transform(plane_center);
const auto cut_matrix = (revert_move ? move2 : Transform3d::Identity()) * m_rotation_m.inverse() * move;
@ -1257,12 +1257,16 @@ BoundingBoxf3 GLGizmoCut3D::transformed_bounding_box(const Vec3d& plane_center,
// respect just to the solid parts for FFF and ignore pad and supports for SLA
if (!volume->is_modifier && !volume->is_sla_pad() && !volume->is_sla_support()) {
#if ENABLE_WORLD_COORDINATE
const auto instance_matrix = volume->get_instance_transformation().get_matrix_no_offset();
#else
const auto instance_matrix = assemble_transform(
Vec3d::Zero(), // don't apply offset
volume->get_instance_rotation().cwiseProduct(Vec3d(1.0, 1.0, 1.0)),
volume->get_instance_scaling_factor(),
volume->get_instance_mirror()
);
#endif // ENABLE_WORLD_COORDINATE
auto volume_trafo = instance_matrix * volume->get_volume_transformation().get_matrix();
@ -1794,11 +1798,18 @@ void GLGizmoCut3D::on_render_input_window(float x, float y, float bottom_limit)
Transform3d GLGizmoCut3D::get_volume_transformation(const ModelVolume* volume) const
{
bool is_prizm_dowel = m_connector_type == CutConnectorType::Dowel && m_connector_style == size_t(CutConnectorStyle::Prizm);
#if ENABLE_WORLD_COORDINATE
const Transform3d connector_trafo = is_prizm_dowel ?
Geometry::translation_transform(-m_connector_depth_ratio * Vec3d::UnitZ()) * m_rotation_m * Geometry::scale_transform({ 0.5 * m_connector_size, 0.5 * m_connector_size, 2 * m_connector_depth_ratio }) :
m_rotation_m * Geometry::scale_transform({ 0.5 * m_connector_size, 0.5 * m_connector_size, m_connector_depth_ratio });
#else
const Transform3d connector_trafo = assemble_transform(
is_prizm_dowel ? Vec3d(0.0, 0.0, -m_connector_depth_ratio) : Vec3d::Zero(),
Transformation(m_rotation_m).get_rotation(),
Vec3d(0.5*m_connector_size, 0.5*m_connector_size, is_prizm_dowel ? 2 * m_connector_depth_ratio : m_connector_depth_ratio),
Vec3d::Ones());
#endif // ENABLE_WORLD_COORDINATE
const Vec3d connector_bb = m_connector_mesh.transformed_bounding_box(connector_trafo).size();
const Vec3d bb = volume->mesh().bounding_box().size();
@ -1812,7 +1823,7 @@ Transform3d GLGizmoCut3D::get_volume_transformation(const ModelVolume* volume) c
const Vec3d offset(vol_trans.x() * border_scale.x(), vol_trans.y() * border_scale.y(), vol_trans.z() * border_scale.z());
// scale and translate volume to suppress to put connectors too close to the border
return assemble_transform(offset, Vec3d::Zero(), Vec3d::Ones() - border_scale, Vec3d::Ones()) * vol_matrix;
return translation_transform(offset) * scale_transform(Vec3d::Ones() - border_scale) * vol_matrix;
}
bool GLGizmoCut3D::is_conflict_for_connector(size_t idx, const CutConnectors& connectors, const Vec3d cur_pos)
@ -1979,13 +1990,13 @@ void GLGizmoCut3D::perform_cut(const Selection& selection)
// update connectors pos as offset of its center before cut performing
apply_connectors_in_model(mo, create_dowels_as_separate_object);
plater->cut(object_idx, instance_idx, assemble_transform(cut_center_offset) * m_rotation_m,
plater->cut(object_idx, instance_idx, translation_transform(cut_center_offset) * m_rotation_m,
only_if(has_connectors ? true : m_keep_upper, ModelObjectCutAttribute::KeepUpper) |
only_if(has_connectors ? true : m_keep_lower, ModelObjectCutAttribute::KeepLower) |
only_if(m_place_on_cut_upper, ModelObjectCutAttribute::PlaceOnCutUpper) |
only_if(m_place_on_cut_lower, ModelObjectCutAttribute::PlaceOnCutLower) |
only_if(m_rotate_upper, ModelObjectCutAttribute::FlipUpper) |
only_if(m_rotate_lower, ModelObjectCutAttribute::FlipLower) |
only_if(m_place_on_cut_upper, ModelObjectCutAttribute::PlaceOnCutUpper) |
only_if(m_place_on_cut_lower, ModelObjectCutAttribute::PlaceOnCutLower) |
only_if(m_rotate_upper, ModelObjectCutAttribute::FlipUpper) |
only_if(m_rotate_lower, ModelObjectCutAttribute::FlipLower) |
only_if(create_dowels_as_separate_object, ModelObjectCutAttribute::CreateDowels));
}
}
@ -2001,7 +2012,7 @@ bool GLGizmoCut3D::unproject_on_cut_plane(const Vec2d& mouse_position, std::pair
const ModelObject* mo = m_c->selection_info()->model_object();
const ModelInstance* mi = mo->instances[m_c->selection_info()->get_active_instance()];
const Transform3d instance_trafo = sla_shift > 0.f ?
assemble_transform(Vec3d(0.0, 0.0, sla_shift)) * mi->get_transformation().get_matrix() : mi->get_transformation().get_matrix();
translation_transform(sla_shift * Vec3d::UnitZ()) * mi->get_transformation().get_matrix() : mi->get_transformation().get_matrix();
const Camera& camera = wxGetApp().plater()->get_camera();
int mesh_id = -1;

View File

@ -117,7 +117,7 @@ void GLGizmoFlatten::on_render()
const Transform3d& inst_matrix = selection.get_first_volume()->get_instance_transformation().get_matrix();
#if ENABLE_LEGACY_OPENGL_REMOVAL
const Camera& camera = wxGetApp().plater()->get_camera();
const Transform3d model_matrix = Geometry::assemble_transform(selection.get_first_volume()->get_sla_shift_z() * Vec3d::UnitZ()) * inst_matrix;
const Transform3d model_matrix = Geometry::translation_transform(selection.get_first_volume()->get_sla_shift_z() * Vec3d::UnitZ()) * inst_matrix;
const Transform3d view_model_matrix = camera.get_view_matrix() * model_matrix;
shader->set_uniform("view_model_matrix", view_model_matrix);
@ -168,7 +168,7 @@ void GLGizmoFlatten::on_register_raycasters_for_picking()
if (!m_planes.empty()) {
const Selection& selection = m_parent.get_selection();
const Transform3d matrix = Geometry::assemble_transform(selection.get_first_volume()->get_sla_shift_z() * Vec3d::UnitZ()) *
const Transform3d matrix = Geometry::translation_transform(selection.get_first_volume()->get_sla_shift_z() * Vec3d::UnitZ()) *
selection.get_first_volume()->get_instance_transformation().get_matrix();
for (int i = 0; i < (int)m_planes.size(); ++i) {
@ -204,7 +204,7 @@ void GLGizmoFlatten::on_render_for_picking()
#if ENABLE_LEGACY_OPENGL_REMOVAL
const Camera& camera = wxGetApp().plater()->get_camera();
const Transform3d view_model_matrix = camera.get_view_matrix() *
Geometry::assemble_transform(selection.get_first_volume()->get_sla_shift_z() * Vec3d::UnitZ()) * m;
Geometry::translation_transform(selection.get_first_volume()->get_sla_shift_z() * Vec3d::UnitZ()) * m;
shader->set_uniform("view_model_matrix", view_model_matrix);
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
@ -348,7 +348,7 @@ void GLGizmoFlatten::update_planes()
// And yes, it is a nasty thing to do. Whoever has time is free to refactor.
Vec3d bb_size = BoundingBoxf3(polygon).size();
float sf = std::min(1./bb_size(0), 1./bb_size(1));
Transform3d tr = Geometry::assemble_transform(Vec3d::Zero(), Vec3d::Zero(), Vec3d(sf, sf, 1.f));
Transform3d tr = Geometry::scale_transform({ sf, sf, 1.f });
polygon = transform(polygon, tr);
polygon = Slic3r::Geometry::convex_hull(polygon);
polygon = transform(polygon, tr.inverse());

View File

@ -430,7 +430,7 @@ double GLGizmoMove3D::calc_projection(const UpdateData& data) const
#if ENABLE_LEGACY_OPENGL_REMOVAL
Transform3d GLGizmoMove3D::local_transform(const Selection& selection) const
{
Transform3d ret = Geometry::assemble_transform(m_center);
Transform3d ret = Geometry::translation_transform(m_center);
if (!wxGetApp().obj_manipul()->is_world_coordinates()) {
const GLVolume& v = *selection.get_first_volume();
Transform3d orient_matrix = v.get_instance_transformation().get_rotation_matrix();

View File

@ -364,8 +364,8 @@ void GLGizmoPainterBase::render_cursor_sphere(const Transform3d& trafo) const
const Camera& camera = wxGetApp().plater()->get_camera();
Transform3d view_model_matrix = camera.get_view_matrix() * trafo *
Geometry::assemble_transform(m_rr.hit.cast<double>()) * complete_scaling_matrix_inverse *
Geometry::assemble_transform(Vec3d::Zero(), Vec3d::Zero(), m_cursor_radius * Vec3d::Ones());
Geometry::translation_transform(m_rr.hit.cast<double>()) * complete_scaling_matrix_inverse *
Geometry::scale_transform(m_cursor_radius * Vec3d::Ones());
shader->set_uniform("view_model_matrix", view_model_matrix);
shader->set_uniform("projection_matrix", camera.get_projection_matrix());

View File

@ -285,7 +285,7 @@ void GLGizmoScale3D::on_render()
}
else {
m_bounding_box = selection.get_bounding_box();
m_grabbers_transform = Geometry::assemble_transform(m_bounding_box.center());
m_grabbers_transform = Geometry::translation_transform(m_bounding_box.center());
m_center = m_bounding_box.center();
m_instance_center = selection.is_single_full_instance() ? selection.get_first_volume()->get_instance_offset() : m_center;
}
@ -911,7 +911,7 @@ double GLGizmoScale3D::calc_ratio(const UpdateData& data) const
#if ENABLE_LEGACY_OPENGL_REMOVAL
Transform3d GLGizmoScale3D::local_transform(const Selection& selection) const
{
Transform3d ret = Geometry::assemble_transform(m_center);
Transform3d ret = Geometry::translation_transform(m_center);
if (!wxGetApp().obj_manipul()->is_world_coordinates()) {
const GLVolume& v = *selection.get_first_volume();
Transform3d orient_matrix = v.get_instance_transformation().get_rotation_matrix();

View File

@ -316,11 +316,11 @@ void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking)
#if ENABLE_LEGACY_OPENGL_REMOVAL
const Transform3d model_matrix = vol->world_matrix() * support_matrix * Transform3d(aa.toRotationMatrix()) *
#if ENABLE_RAYCAST_PICKING
Geometry::assemble_transform((CONE_HEIGHT + support_point.head_front_radius * RenderPointScale) * Vec3d::UnitZ(),
Vec3d(PI, 0.0, 0.0), Vec3d(CONE_RADIUS, CONE_RADIUS, CONE_HEIGHT));
Geometry::translation_transform((CONE_HEIGHT + support_point.head_front_radius * RenderPointScale) * Vec3d::UnitZ()) *
Geometry::rotation_transform({ double(PI), 0.0, 0.0 }) * Geometry::scale_transform({ CONE_RADIUS, CONE_RADIUS, CONE_HEIGHT });
#else
Geometry::assemble_transform((cone_height + support_point.head_front_radius * RenderPointScale) * Vec3d::UnitZ(),
Vec3d(PI, 0.0, 0.0), Vec3d(cone_radius, cone_radius, cone_height));
Geometry::translation_transform((cone_height + support_point.head_front_radius * RenderPointScale) * Vec3d::UnitZ()) *
Geometry::rotation_transform({ double(PI), 0.0, 0.0 }), * Geometry::scale_transform({ cone_radius, cone_radius, cone_height });
#endif // ENABLE_RAYCAST_PICKING
shader->set_uniform("view_model_matrix", view_matrix * model_matrix);
@ -1463,9 +1463,9 @@ void GLGizmoSlaSupports::update_raycasters_for_picking_transform()
q.setFromTwoVectors(Vec3d::UnitZ(), instance_scaling_matrix_inverse * m_editing_cache[i].normal.cast<double>());
const Eigen::AngleAxisd aa(q);
const Transform3d cone_matrix = vol->world_matrix() * support_matrix * Transform3d(aa.toRotationMatrix()) *
Geometry::assemble_transform((CONE_HEIGHT + m_editing_cache[i].support_point.head_front_radius * RenderPointScale) * Vec3d::UnitZ(),
Vec3d(PI, 0.0, 0.0), Vec3d(CONE_RADIUS, CONE_RADIUS, CONE_HEIGHT));
m_raycasters[i].second->set_transform(cone_matrix);
Geometry::translation_transform((CONE_HEIGHT + m_editing_cache[i].support_point.head_front_radius * RenderPointScale) * Vec3d::UnitZ()) *
Geometry::rotation_transform({ double(PI), 0.0, 0.0 }) * Geometry::scale_transform({ CONE_RADIUS, CONE_RADIUS, CONE_HEIGHT });
m_raycasters[i].second->set_transform(cone_matrix);
const double radius = (double)m_editing_cache[i].support_point.head_front_radius * RenderPointScale;
const Transform3d sphere_matrix = vol->world_matrix() * support_matrix * Geometry::scale_transform(radius);

View File

@ -386,6 +386,8 @@ void OG_CustomCtrl::correct_widgets_position(wxSizer* widget, const Line& line,
void OG_CustomCtrl::init_max_win_width()
{
m_max_win_width = 0;
if (opt_group->ctrl_horiz_alignment == wxALIGN_RIGHT && m_max_win_width == 0)
for (CtrlLine& line : ctrl_lines) {
if (int max_win_width = line.get_max_win_width();
@ -419,7 +421,7 @@ void OG_CustomCtrl::msw_rescale()
m_bmp_mode_sz = get_bitmap_size(get_bmp_bundle("mode_simple", wxOSX ? 10 : 12), this);
m_bmp_blinking_sz = get_bitmap_size(get_bmp_bundle("search_blink"), this);
m_max_win_width = 0;
init_max_win_width();
wxCoord v_pos = 0;
for (CtrlLine& line : ctrl_lines) {

View File

@ -756,12 +756,8 @@ void PreferencesDialog::msw_rescale()
{
for (ConfigOptionsGroup* og : this->optgroups())
og->msw_rescale();
#ifdef _WIN32
m_optgroup_dark_mode->msw_rescale();
#endif //_WIN32
#if ENABLE_ENVIRONMENT_MAP
m_optgroup_render->msw_rescale();
#endif // ENABLE_ENVIRONMENT_MAP
update_ctrls_alignment();
msw_buttons_rescale(this, em_unit(), { wxID_OK, wxID_CANCEL });

View File

@ -1767,7 +1767,7 @@ void Selection::render_sidebar_hints(const std::string& sidebar_field)
glsafe(::glEnable(GL_DEPTH_TEST));
#if ENABLE_LEGACY_OPENGL_REMOVAL
const Transform3d base_matrix = Geometry::assemble_transform(get_bounding_box().center());
const Transform3d base_matrix = Geometry::translation_transform(get_bounding_box().center());
Transform3d orient_matrix = Transform3d::Identity();
#else
glsafe(::glPushMatrix());
@ -1902,7 +1902,7 @@ void Selection::render_sidebar_hints(const std::string& sidebar_field)
#if ENABLE_WORLD_COORDINATE
if (!boost::starts_with(sidebar_field, "layer")) {
if (!wxGetApp().obj_manipul()->is_world_coordinates())
m_axes.render(Geometry::assemble_transform(axes_center) * orient_matrix, 0.25f);
m_axes.render(Geometry::translation_transform(axes_center) * orient_matrix, 0.25f);
}
#endif // ENABLE_WORLD_COORDINATE
#else
@ -2613,7 +2613,7 @@ void Selection::render_sidebar_position_hints(const std::string& sidebar_field)
shader.set_uniform("projection_matrix", camera.get_projection_matrix());
if (boost::ends_with(sidebar_field, "x")) {
const Transform3d model_matrix = matrix * Geometry::assemble_transform(Vec3d::Zero(), -0.5 * PI * Vec3d::UnitZ());
const Transform3d model_matrix = matrix * Geometry::rotation_transform(-0.5 * PI * Vec3d::UnitZ());
shader.set_uniform("view_model_matrix", view_matrix * model_matrix);
const Matrix3d view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * model_matrix.matrix().block(0, 0, 3, 3).inverse().transpose();
shader.set_uniform("view_normal_matrix", view_normal_matrix);
@ -2627,7 +2627,7 @@ void Selection::render_sidebar_position_hints(const std::string& sidebar_field)
m_arrow.render();
}
else if (boost::ends_with(sidebar_field, "z")) {
const Transform3d model_matrix = matrix * Geometry::assemble_transform(Vec3d::Zero(), 0.5 * PI * Vec3d::UnitX());
const Transform3d model_matrix = matrix * Geometry::rotation_transform(0.5 * PI * Vec3d::UnitX());
shader.set_uniform("view_model_matrix", view_matrix * model_matrix);
const Matrix3d view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * model_matrix.matrix().block(0, 0, 3, 3).inverse().transpose();
shader.set_uniform("view_normal_matrix", view_normal_matrix);
@ -2664,7 +2664,7 @@ void Selection::render_sidebar_rotation_hints(const std::string& sidebar_field)
Matrix3d view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * model_matrix.matrix().block(0, 0, 3, 3).inverse().transpose();
shader.set_uniform("view_normal_matrix", view_normal_matrix);
m_curved_arrow.render();
const Transform3d matrix = model_matrix * Geometry::assemble_transform(Vec3d::Zero(), PI * Vec3d::UnitZ());
const Transform3d matrix = model_matrix * Geometry::rotation_transform(PI * Vec3d::UnitZ());
shader.set_uniform("view_model_matrix", view_matrix * matrix);
view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * matrix.matrix().block(0, 0, 3, 3).inverse().transpose();
shader.set_uniform("view_normal_matrix", view_normal_matrix);
@ -2677,11 +2677,11 @@ void Selection::render_sidebar_rotation_hints(const std::string& sidebar_field)
if (boost::ends_with(sidebar_field, "x")) {
m_curved_arrow.set_color(get_color(X));
render_sidebar_rotation_hint(shader, view_matrix, matrix * Geometry::assemble_transform(Vec3d::Zero(), 0.5 * PI * Vec3d::UnitY()));
render_sidebar_rotation_hint(shader, view_matrix, matrix * Geometry::rotation_transform(0.5 * PI * Vec3d::UnitY()));
}
else if (boost::ends_with(sidebar_field, "y")) {
m_curved_arrow.set_color(get_color(Y));
render_sidebar_rotation_hint(shader, view_matrix, matrix * Geometry::assemble_transform(Vec3d::Zero(), -0.5 * PI * Vec3d::UnitX()));
render_sidebar_rotation_hint(shader, view_matrix, matrix * Geometry::rotation_transform(-0.5 * PI * Vec3d::UnitX()));
}
else if (boost::ends_with(sidebar_field, "z")) {
m_curved_arrow.set_color(get_color(Z));
@ -2726,7 +2726,7 @@ void Selection::render_sidebar_scale_hints(const std::string& sidebar_field)
#if ENABLE_LEGACY_OPENGL_REMOVAL
auto render_sidebar_scale_hint = [this, uniform_scale](Axis axis, GLShaderProgram& shader, const Transform3d& view_matrix, const Transform3d& model_matrix) {
m_arrow.set_color(uniform_scale ? UNIFORM_SCALE_COLOR : get_color(axis));
Transform3d matrix = model_matrix * Geometry::assemble_transform(5.0 * Vec3d::UnitY());
Transform3d matrix = model_matrix * Geometry::translation_transform(5.0 * Vec3d::UnitY());
shader.set_uniform("view_model_matrix", view_matrix * matrix);
Matrix3d view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * matrix.matrix().block(0, 0, 3, 3).inverse().transpose();
shader.set_uniform("view_normal_matrix", view_normal_matrix);
@ -2742,7 +2742,7 @@ void Selection::render_sidebar_scale_hints(const std::string& sidebar_field)
m_arrow.render();
#if ENABLE_LEGACY_OPENGL_REMOVAL
matrix = model_matrix * Geometry::assemble_transform(-5.0 * Vec3d::UnitY(), PI * Vec3d::UnitZ());
matrix = model_matrix * Geometry::translation_transform(-5.0 * Vec3d::UnitY()) * Geometry::rotation_transform(PI * Vec3d::UnitZ());
shader.set_uniform("view_model_matrix", view_matrix * matrix);
view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * matrix.matrix().block(0, 0, 3, 3).inverse().transpose();
shader.set_uniform("view_normal_matrix", view_normal_matrix);
@ -2761,7 +2761,7 @@ void Selection::render_sidebar_scale_hints(const std::string& sidebar_field)
if (boost::ends_with(sidebar_field, "x") || uniform_scale) {
#if ENABLE_LEGACY_OPENGL_REMOVAL
render_sidebar_scale_hint(X, shader, view_matrix, matrix * Geometry::assemble_transform(Vec3d::Zero(), -0.5 * PI * Vec3d::UnitZ()));
render_sidebar_scale_hint(X, shader, view_matrix, matrix * Geometry::rotation_transform(-0.5 * PI * Vec3d::UnitZ()));
#else
glsafe(::glPushMatrix());
glsafe(::glRotated(-90.0, 0.0, 0.0, 1.0));
@ -2782,7 +2782,7 @@ void Selection::render_sidebar_scale_hints(const std::string& sidebar_field)
if (boost::ends_with(sidebar_field, "z") || uniform_scale) {
#if ENABLE_LEGACY_OPENGL_REMOVAL
render_sidebar_scale_hint(Z, shader, view_matrix, matrix * Geometry::assemble_transform(Vec3d::Zero(), 0.5 * PI * Vec3d::UnitX()));
render_sidebar_scale_hint(Z, shader, view_matrix, matrix * Geometry::rotation_transform(0.5 * PI * Vec3d::UnitX()));
#else
glsafe(::glPushMatrix());
glsafe(::glRotated(90.0, 1.0, 0.0, 0.0));

View File

@ -2156,6 +2156,16 @@ void TabFilament::clear_pages()
m_cooling_description_line = nullptr;
}
void TabFilament::msw_rescale()
{
for (const auto& over_opt : m_overrides_options) {
wxWindow* win = over_opt.second;
win->SetInitialSize(win->GetBestSize());
}
Tab::msw_rescale();
}
wxSizer* Tab::description_line_widget(wxWindow* parent, ogStaticText* *StaticText, wxString text /*= wxEmptyString*/)
{
*StaticText = new ogStaticText(parent, text);

View File

@ -449,6 +449,7 @@ public:
void toggle_options() override;
void update() override;
void clear_pages() override;
void msw_rescale() override;
bool supports_printer_technology(const PrinterTechnology tech) const override { return tech == ptFFF; }
};