# Feature

# Feature

Artifact:[androidx.graphics:graphics-shapes](https://developer.android.com/jetpack/androidx/releases/graphics)  
[View Source](https://cs.android.com/search?q=file:androidx/graphics/shapes/Features.kt+class:androidx.graphics.shapes.Feature)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/graphics/shapes/Feature "View this page in Java")
Common/AllAndroid/JVM
  - Cmn  

  ```
  abstract class Feature
  ```

*** ** * ** ***

While a polygon's shape can be drawn solely using a list of[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic)objects representing its raw curves and lines, features add an extra layer of context to groups of cubics. Features group cubics into (straight) edges, convex corners, or concave corners. For example, rounding a rectangle adds many cubics around its edges, but the rectangle's overall number of corners remains the same.[Morph](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Morph)therefore uses this grouping for several reasons:

- Noise Reduction: Grouping cubics reduces the amount of noise introduced by individual cubics (as seen in the rounded rectangle example).

- Mapping Base: The grouping serves as the base set for[Morph](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Morph)'s mapping process.

- Curve Type Mapping:[Morph](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Morph)maps similar curve types (convex, concave) together. Note that edges or features created with[buildIgnorableFeature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature#buildIgnorableFeature(kotlin.collections.List))are ignored in the default mapping.

By using features, you can manipulate polygon shapes with more context and control.

## Summary

|                                                  ### Nested types                                                   |
|---------------------------------------------------------------------------------------------------------------------|
| `object `[Feature.Factory](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature.Factory) |

|                               ### Public companion functions                               |
|--------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| [Feature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature) | [buildConcaveCorner](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature#buildConcaveCorner(kotlin.collections.List))`(cubics: `[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic)`>)` Group a list of[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic)objects to a concave corner (inward indentation in a shape).                                                                                                   | Cmn |
| [Feature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature) | [buildConvexCorner](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature#buildConvexCorner(kotlin.collections.List))`(cubics: `[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic)`>)` Group a list of[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic)objects to a convex corner (outward indentation in a shape).                                                                                                     | Cmn |
| [Feature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature) | [buildEdge](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature#buildEdge(androidx.graphics.shapes.Cubic))`(cubic: `[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic)`)` Group a[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic)object to an edge (neither inward or outward identification in a shape).                                                                                                                                                                                                        | Cmn |
| [Feature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature) | [buildIgnorableFeature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature#buildIgnorableFeature(kotlin.collections.List))`(cubics: `[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic)`>)` Group a list of[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic)objects to a feature that should be ignored in the default[Morph](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Morph)mapping. | Cmn |

|                                                                                                                                                   ### Public constructors                                                                                                                                                    |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| [Feature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature#Feature(kotlin.collections.List))`(cubics: `[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic)`>)` | Cmn |

|                                         ### Public functions                                          |
|-------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| `abstract `[Feature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature) | [reversed](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature#reversed())`()` Returns a new[Feature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature)with the points that define the shape of this[Feature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature)in reversed order.                                                                                                                                                                                                                                                             | Cmn |
| `abstract `[Feature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature) | [transformed](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature#transformed(androidx.graphics.shapes.PointTransformer))`(f: `[PointTransformer](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/PointTransformer)`)` Transforms the points in this[Feature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature)with the given[PointTransformer](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/PointTransformer)and returns a new[Feature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature) | Cmn |

|                                                                                 ### Public properties                                                                                 |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| [List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic)`>` | [cubics](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature#cubics())                                                                                             | Cmn |
| `abstract `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                        | [isConcaveCorner](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature#isConcaveCorner()) Whether this Feature is a concave corner (inward indentation in a shape). | Cmn |
| `abstract `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                        | [isConvexCorner](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature#isConvexCorner()) Whether this Feature is a convex corner (outward indentation in a shape).   | Cmn |
| `abstract `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                        | [isEdge](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature#isEdge()) Whether this Feature is an Edge with no inward or outward indentation.                      | Cmn |
| `abstract `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                        | [isIgnorableFeature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature#isIgnorableFeature()) Whether this Feature gets ignored in the Morph mapping.             | Cmn |

## Public companion functions

### buildConcaveCorner

Cmn  

```
fun buildConcaveCorner(cubics: List<Cubic>): Feature
```

Group a list of[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic)objects to a concave corner (inward indentation in a shape).  

|                                                                                           Parameters                                                                                            |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------|
| `cubics: `[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic)`>` | The list of raw cubics describing the corner's shape |

|                                                             Throws                                                             |
|--------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------|
| [kotlin.IllegalArgumentException](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html) | for lists of empty cubics or non-continuous cubics |

### buildConvexCorner

Cmn  

```
fun buildConvexCorner(cubics: List<Cubic>): Feature
```

Group a list of[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic)objects to a convex corner (outward indentation in a shape).  

|                                                                                           Parameters                                                                                            |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------|
| `cubics: `[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic)`>` | The list of raw cubics describing the corner's shape |

|                                                             Throws                                                             |
|--------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------|
| [kotlin.IllegalArgumentException](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html) | for lists of empty cubics or non-continuous cubics |

### buildEdge

Cmn  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.1.0)  

```
fun buildEdge(cubic: Cubic): Feature
```

Group a[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic)object to an edge (neither inward or outward identification in a shape).  

|                                           Parameters                                            |
|-------------------------------------------------------------------------------------------------|-------------------------------------------|
| `cubic: `[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic) | The raw cubic describing the edge's shape |

|                                                             Throws                                                             |
|--------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------|
| [kotlin.IllegalArgumentException](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html) | for lists of empty cubics or non-continuous cubics |

### buildIgnorableFeature

Cmn  

```
fun buildIgnorableFeature(cubics: List<Cubic>): Feature
```

Group a list of[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic)objects to a feature that should be ignored in the default[Morph](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Morph)mapping. The feature can have any indentation.

Sometimes, it's helpful to ignore certain features when morphing shapes. This is because only the features you mark as important will be smoothly transitioned between the start and end shapes. Additionally, the default morph algorithm will try to match convex corners to convex corners and concave to concave. Marking features as ignorable will influence this matching. For example, given a 12-pointed star, marking all concave corners as ignorable will create a[Morph](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Morph)that only considers the outer corners of the star. As a result, depending on the morphed to shape, the animation may have fewer intersections and rotations. Another example for the other way around is a[Morph](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Morph)between a pointed up triangle to a square. Marking the square's top edge as a convex corner matches it to the triangle's upper corner. Instead of moving triangle's upper corner to one of rectangle's corners, the animation now splits the triangle to match squares' outer corners.  

|                                                                                           Parameters                                                                                            |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|
| `cubics: `[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Cubic](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Cubic)`>` | The list of raw cubics describing the feature's shape |

|                                                             Throws                                                             |
|--------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------|
| [kotlin.IllegalArgumentException](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html) | for lists of empty cubics or non-continuous cubics |

## Public constructors

### Feature

Cmn  

```
Feature(cubics: List<Cubic>)
```

## Public functions

### reversed

Cmn  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.1.0)  

```
abstract fun reversed(): Feature
```

Returns a new[Feature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature)with the points that define the shape of this[Feature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature)in reversed order.  

### transformed

Cmn  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.1.0)  

```
abstract fun transformed(f: PointTransformer): Feature
```

Transforms the points in this[Feature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature)with the given[PointTransformer](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/PointTransformer)and returns a new[Feature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature)  

|                                                    Parameters                                                     |
|-------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `f: `[PointTransformer](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/PointTransformer) | The[PointTransformer](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/PointTransformer)used to transform this[Feature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature) |

## Public properties

### cubics

Cmn  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.1.0)  

```
val cubics: List<Cubic>
```  

### isConcaveCorner

Cmn  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.1.0)  

```
abstract val isConcaveCorner: Boolean
```

Whether this Feature is a concave corner (inward indentation in a shape).  

### isConvexCorner

Cmn  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.1.0)  

```
abstract val isConvexCorner: Boolean
```

Whether this Feature is a convex corner (outward indentation in a shape).  

### isEdge

Cmn  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.1.0)  

```
abstract val isEdge: Boolean
```

Whether this Feature is an Edge with no inward or outward indentation.  

### isIgnorableFeature

Cmn  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.1.0)  

```
abstract val isIgnorableFeature: Boolean
```

Whether this Feature gets ignored in the Morph mapping. See[buildIgnorableFeature](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/Feature#buildIgnorableFeature(kotlin.collections.List))for more details.