how to calculate the projection area .

how to calculate the projection area .

wokeyiyognshenme
Advocate Advocate
1,301 Views
9 Replies
Message 1 of 10

how to calculate the projection area .

wokeyiyognshenme
Advocate
Advocate

how to calculate the projection area .

there are two rectangle。

the light vector is (x,y,z)

 

one rectangle is projected to another rectangle.

0 Likes
1,302 Views
9 Replies
Replies (9)
Message 2 of 10

wokeyiyognshenme
Advocate
Advocate

阴影面积.jpg

0 Likes
Message 3 of 10

leeminardi
Mentor
Mentor

Your first goal is to create two 2d shapes that lie on a plane that is perpendicular to the light direction vector.  You can do this by multiplying the world coordinates of each point by a transformation or 3D rotation matrix.

 

You can get a description of the rotation matrix here. Note, for your task:

z0 = 0,0,-1   z1 = light ray vector

 

For example, point A in the light ray coordinate system would be:

 

pointAL = pointA * R    (R = the rotation matrix)

pointBL = pointB * R

 

To get the projection of these shapes onto the plane perpendicular to the light vector simply ignore the z coordinate!  For example,

pointAL2D = pointAL(x), pointAL(y), 0

 

 

Now that you have two 2D shapes you need to determine how they overlap.  You can do a web search for a solution or  consider creating two regions from the two 2D shapes and use the AutoCAD Boolean Intersect command to create a region of the overlap.

 

 

...

lee.minardi
0 Likes
Message 4 of 10

wokeyiyognshenme
Advocate
Advocate

so complicated。。。

could you please give some code ?

1、I only know the light vector3d, how to determine the light coordinates

 

VectorZ = the light vector3d

How to determin the VectorX and VectorY

 

2、mathmatic is diffcult. I don't understand mathematics  .I only can use the API.

 

3、 two regions from the two 2D shapes and use the AutoCAD Boolean Intersect  --- i know the API, i can do this.

0 Likes
Message 5 of 10

wokeyiyognshenme
Advocate
Advocate

EFGH is not perpendicular to the light vector.

 

so the intersect of 2 shape is not equal to the shadow。

0 Likes
Message 6 of 10

leeminardi
Mentor
Mentor

@wokeyiyognshenme wrote:

so complicated。。。

could you please give some code ?

1、I only know the light vector3d, how to determine the light coordinates

It is assumed that the light is far away (e.g., the sun) and therefore the light rays are parallel and you do not need the location of the light source.

 

VectorZ = the light vector3d  This is the direction of the light rays.

How to determin the VectorX and VectorY of what

 

2、mathmatic is diffcult. I don't understand mathematics  .I only can use the API.  Then perhaps you should not be trying to write code for this problem.  I assume you had an understanding of vector algebra and matrices.

 

3、 two regions from the two 2D shapes and use the AutoCAD Boolean Intersect  --- i know the API, i can do this.  Great.


 

lee.minardi
0 Likes
Message 7 of 10

leeminardi
Mentor
Mentor

@wokeyiyognshenme wrote:

EFGH is not perpendicular to the light vector.

 

so the intersect of 2 shape is not equal to the shadow。


I know that EFGH is not perpendicular to the light vector.  After you multiply EFGH world coordinates times the rotation matrix you will have 3D coordinates of EFGH in a coordinate system whose z direction is the direction of the light vector.  By ignoring the z coordinate of these coordinates you in effect, project the shapes onto the XY plane of the light vector coordinate system. In this system you have transformed the 2 shapes to 2D shapes that lie on the same plane.

lee.minardi
0 Likes
Message 8 of 10

wokeyiyognshenme
Advocate
Advocate

maytbe ,can use this API ??

Curve.GetProjectedCurve Method
Description
This function creates a new curve entity that is the result of projecting the curve parallel to projectionDirection onto the planeToProjectOn and returns it.


C#
public virtual Curve GetProjectedCurve(
Plane planeToProjectOn,
Vector3d projectionDirection
);

Plane planeToProjectOn Input plane onto which the curve is to be projected
Vector3d projectionDirection Input direction (in WCS coordinates) of the projection

0 Likes
Message 9 of 10

leeminardi
Mentor
Mentor

Do you have a link to the documentation for the function?  I'd like to see the format required to define the plane.

lee.minardi
0 Likes
Message 10 of 10

SEANT61
Advisor
Advisor

@leeminardi wrote:

Do you have a link to the documentation for the function?  I'd like to see the format required to define the plane.


There are several Methods (Overloaded)

https://help.autodesk.com/view/OARX/2020/ENU/?guid=OARX-ManagedRefGuide-__OVERLOADED_Plane_Autodesk_...

 

And the Curve.GetProjectedCurve Method:

AutoCAD 2020 Developer and ObjectARX Help | Curve.GetProjectedCurve Method | Autodesk


************************************************************
May your cursor always snap to the location intended.
0 Likes