Skip to content

Commit

Permalink
Merge pull request #952 from hypar-io/rename-flipped-parameter
Browse files Browse the repository at this point in the history
rename Flipped parameter to `ReverseWinding`
  • Loading branch information
andrewheumann authored Mar 22, 2023
2 parents a8d0554 + 3e05672 commit db61f01
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Added

- `Extrude` Solid Operation supports an optional `Flipped` parameter to purposely turn its normals inside out.
- `Extrude` Solid Operation supports an optional `ReverseWinding` parameter to purposely turn its normals inside out.
- `MappingBase` and first Revit mapping class to support mapping data for a Revit Converter.

### Changed
Expand Down
24 changes: 12 additions & 12 deletions Elements/src/Geometry/Solids/Extrude.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Extrude : SolidOperation, System.ComponentModel.INotifyPropertyChan
private Profile _profile;
private double _height;
private Vector3 _direction;
private bool _flipped;
private bool _reverseWinding;

/// <summary>The id of the profile to extrude.</summary>
[JsonProperty("Profile", Required = Required.AllowNull)]
Expand Down Expand Up @@ -60,16 +60,16 @@ public Vector3 Direction
}
}

/// <summary>Is the extrusion flipped inside out?</summary>
[JsonProperty("Flipped")]
public bool Flipped
/// <summary>Is the extrusion's profile reversed relative to its extrusion vector, resulting in inward-facing face normals?</summary>
[JsonProperty("Reverse Winding")]
public bool FlipNormals
{
get { return _flipped; }
get { return _reverseWinding; }
set
{
if (_flipped != value)
if (_reverseWinding != value)
{
_flipped = value;
_reverseWinding = value;
RaisePropertyChanged();
}
}
Expand All @@ -83,12 +83,12 @@ public bool Flipped
/// <param name="direction">The direction of the extrusion.</param>
/// <param name="isVoid">If true, the extrusion is a "void" in a group
/// of solid operations, subtracted from other solids.</param>
/// <param name="flipped">True if the extrusion should be flipped inside
/// out, with normals facing in instead of out. Use with caution if
/// <param name="reverseWinding">True if the extrusion should be flipped inside
/// out, with face normals facing in instead of out. Use with caution if
/// using with other solid operations in a representation — boolean
/// results may be unexpected.</param>
[JsonConstructor]
public Extrude(Profile profile, double height, Vector3 direction, bool isVoid = false, bool flipped = false)
public Extrude(Profile profile, double height, Vector3 direction, bool isVoid = false, bool reverseWinding = false)
: base(isVoid)
{
if (!Validator.DisableValidationOnConstruction)
Expand All @@ -102,15 +102,15 @@ public Extrude(Profile profile, double height, Vector3 direction, bool isVoid =
this._profile = profile;
this._height = height;
this._direction = direction;
this._flipped = flipped;
this._reverseWinding = reverseWinding;

this.PropertyChanged += (sender, args) => { UpdateGeometry(); };
UpdateGeometry();
}

private void UpdateGeometry()
{
this._solid = Kernel.Instance.CreateExtrude(this._profile, this._height, this._direction, this._flipped);
this._solid = Kernel.Instance.CreateExtrude(this._profile, this._height, this._direction, this._reverseWinding);
}
}
}

0 comments on commit db61f01

Please sign in to comment.