|
1 | 1 | //===----------------------------------------------------------------------===// |
2 | 2 | // |
3 | | -// Copyright (c) 2021 Svyatoslav Popov. |
| 3 | +// Copyright (c) 2022 Svyatoslav Popov ([email protected]). |
4 | 4 | // |
5 | 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
6 | 6 | // the License. You may obtain a copy of the License at |
@@ -371,14 +371,21 @@ where Math : KvMathScope, Vertex : KvVertex3Protocol, Vertex.Math == Math |
371 | 371 |
|
372 | 372 | // MARK: Operators |
373 | 373 |
|
| 374 | + /// - Returns: A transformed deep copy of the receiver. |
| 375 | + @inlinable |
| 376 | + public static func *(lhs: KvAffineTransform3<Math>, rhs: Self) -> Self { |
| 377 | + KvTransform3<Math>(lhs) * rhs |
| 378 | + } |
| 379 | + |
| 380 | + |
374 | 381 | /// - Returns: A transformed deep copy of the receiver. |
375 | 382 | @inlinable |
376 | 383 | public static func *(lhs: KvTransform3<Math>, rhs: Self) -> Self { |
377 | 384 | let (t, scale) = Transform.from(lhs) |
378 | 385 |
|
379 | 386 | let (ccw, cw): ([Polygon2], [Polygon2]) = scale.map { scale in |
380 | 387 |
|
381 | | - func Scaled(_ polygons: [Polygon2], by scale: KvTransform3<Math>) -> [Polygon2] { |
| 388 | + func Scaled(_ polygons: [Polygon2], by scale: KvAffineTransform3<Math>) -> [Polygon2] { |
382 | 389 | polygons.map { scale * $0 } |
383 | 390 | } |
384 | 391 |
|
@@ -723,6 +730,15 @@ where Math : KvMathScope, Vertex : KvVertex3Protocol, Vertex.Math == Math |
723 | 730 |
|
724 | 731 | // MARK: Operators |
725 | 732 |
|
| 733 | + /// - Returns: A copy of the receiver's subtree where all the nodes are transformed. |
| 734 | + @inlinable |
| 735 | + public static func *(lhs: KvAffineTransform3<Math>, rhs: Node) -> Node { |
| 736 | + Node(polygons: lhs * rhs._polygons, |
| 737 | + front: rhs._front.map { lhs * $0 }, |
| 738 | + back: rhs._back.map { lhs * $0 }) |
| 739 | + } |
| 740 | + |
| 741 | + |
726 | 742 | /// - Returns: A copy of the receiver's subtree where all the nodes are transformed. |
727 | 743 | @inlinable |
728 | 744 | public static func *(lhs: KvTransform3<Math>, rhs: Node) -> Node { |
|
0 commit comments