Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
c785d9d
changed getCompoundPathString to use the new function for compound pa…
ekim39 Dec 3, 2025
2139abe
currently can draw each individual link correctly in a welded link, s…
ekim39 Dec 3, 2025
858b930
added the intersection methods with for line/line, line/arc, arc/arc,…
ekim39 Dec 4, 2025
3c739a9
added checks in solveForExternalLines to check for duplicate intersec…
ekim39 Dec 4, 2025
3fe7c06
added functions to group the intersection points by the lines/segment…
ekim39 Dec 4, 2025
00e60b7
Found a few bugs with the isPointOnLine and isPointOnArc functions an…
ekim39 Dec 5, 2025
1a2453a
fixed an issue with arc/arc intersection where only one of the two in…
ekim39 Dec 5, 2025
1e2f86e
got rid of some unneeded commented out code
ekim39 Dec 5, 2025
633a17e
changed equals to loosely equals for adding duplicate lines back in b…
ekim39 Dec 5, 2025
98fa41a
changed looselyequals to equals in the line to line intersection beca…
ekim39 Dec 9, 2025
40b9329
working on identifying whether an intersection between arc and line i…
ekim39 Dec 11, 2025
ad59066
Changed point in link function to check for tangent point in arc/line…
ekim39 Jan 16, 2026
8d51a71
fixed a typo in arc/arc intersect where center should have been center2
ekim39 Jan 16, 2026
6b13f8c
added positive infinity to the check for tangents
ekim39 Jan 18, 2026
a5fc804
fixed issue where new lines added were not checked to see if path was…
ekim39 Jan 18, 2026
dec819f
Added code to make the corner where two lines intersect a concave curve
ekim39 Jan 20, 2026
8965972
Removed some unnecessary code and added a few comments for clarity
ekim39 Jan 20, 2026
198ac84
fixed issue where an arc with multiple intersections had segment spli…
ekim39 Jan 21, 2026
f6b3014
changed welded joint shape to bring icon forward and center it
ekim39 Jan 26, 2026
12a4131
fixed the bug where a segment where the endpoints are both intersecti…
ekim39 Feb 18, 2026
4c5ee59
I deleted some unneeded code
ekim39 Feb 18, 2026
9c516c4
Changing visuals of tracer and welded joints
ekim39 Feb 19, 2026
5d92a93
Added function to check if mechanism is welded and then changed trace…
ekim39 Feb 19, 2026
2dc6000
added code to check which link the mouse coordinates is over and then…
ekim39 Feb 23, 2026
d99784c
added code to get the joint of the trajectory and then pass it to the…
ekim39 Feb 23, 2026
f1e234e
changed trajectory to a dashed line based on whether the joint is a t…
ekim39 Feb 23, 2026
a828570
Added a context menu option to link interactor for the circular input
ekim39 Mar 3, 2026
d6a2e92
changed disabled for circular input menu option so that it is disable…
ekim39 Mar 3, 2026
ababa75
added private field to check if link is a circular link
ekim39 Mar 3, 2026
77df6c8
added a method to convert a number in model into svg scale
ekim39 Mar 3, 2026
d76bf97
added code so that when context menu for circular input is clicked tu…
ekim39 Mar 3, 2026
e350aeb
added code to draw a circular link
ekim39 Mar 3, 2026
9b39953
removed unnecessary code
ekim39 Mar 3, 2026
80b5b8e
added undo and redo for adding a circular input link
ekim39 Mar 4, 2026
2194ee7
Added icon for undoing circular
ekim39 Mar 16, 2026
6317869
Updated wording for context menu and also updated the circular links
ekim39 Mar 16, 2026
32c388a
now any link with a ground joint can be made circular
ekim39 Mar 16, 2026
af90bfc
fixed issue with circle not forming for grounded link. Need to fix is…
ekim39 Mar 16, 2026
dc6bd88
fixed issue with circular link not being created for any link besides…
ekim39 Mar 18, 2026
64782b8
added compoundlinksnapshot and fields into interface for deleting com…
ekim39 Mar 23, 2026
f4d2286
added a function to remove compound links by their id
ekim39 Mar 23, 2026
2119e6d
passing in undo/redo service to compound link interactor
ekim39 Mar 23, 2026
b9b8cc3
edited delete compound link context menu so that it records informati…
ekim39 Mar 23, 2026
9d975e2
edited undo redo service so that the undo for delete compound link re…
ekim39 Mar 23, 2026
3f80d3d
Added redo for delete compound link
ekim39 Mar 23, 2026
da76105
fixed undo/redo of tracer points, adding. Need to fix deleting of tra…
ekim39 Mar 24, 2026
d1a5ec8
fixed delete tracer point for welded (compound) links
ekim39 Mar 31, 2026
41e1116
fixed tracer point outline still being dashed even after making the j…
ekim39 Mar 31, 2026
a07addf
solved merge conflicts from pulling from main
ekim39 Apr 1, 2026
2943c0a
fixed a line of code that was breaking, which is adding a few fields …
ekim39 Apr 9, 2026
d34c48d
Merge branch 'main' of github.com:PMKS-Web/PMKS-Refactor into circula…
ekim39 Apr 9, 2026
d228f4f
Fixed issue with url sharing service of welded links not being create…
ekim39 Apr 16, 2026
d70644b
added in encoding and decoding/reconstruction of circular links
ekim39 Apr 16, 2026
2fda2bd
Merge branch 'main' of github.com:PMKS-Web/PMKS-Refactor into circula…
ekim39 Apr 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { UnitConversionService } from 'src/app/services/unit-conversion.service'
import { NotificationService } from 'src/app/services/notification.service';

import { AnimationService } from 'src/app/services/animation.service';
import {UndoRedoService} from "../../../services/undo-redo.service";

@Component({
selector: '[app-compound-link]',
Expand All @@ -27,13 +28,14 @@ export class CompoundLinkComponent extends AbstractInteractiveComponent {
private svgPathService: SVGPathService,
private unitConversionService: UnitConversionService,
private notificationService: NotificationService,
public override animationService: AnimationService
public override animationService: AnimationService,
private undoRedoService: UndoRedoService
) {
super(interactionService,animationService);
}

override registerInteractor(): Interactor {
return new CompoundLinkInteractor(this.compoundLink, this.stateService, this.notificationService);
return new CompoundLinkInteractor(this.compoundLink, this.stateService, this.notificationService, this.undoRedoService);
}

getColor():string{
Expand All @@ -49,7 +51,8 @@ export class CompoundLinkComponent extends AbstractInteractiveComponent {
let allCoordsAsArray: Coord[] = Array.from(allUniqueJointCoords,(coord,index) =>{
return this.unitConversionService.modelCoordToSVGCoord(coord);
});
return this.svgPathService.getSingleLinkDrawnPath(allCoordsAsArray, radius);
return this.svgPathService.calculateCompoundPath(this.compoundLink.links, allCoordsAsArray, radius);
//return this.svgPathService.getSingleLinkDrawnPath(allCoordsAsArray, radius);
}
getStrokeColor(): string{
if (this.getInteractor().isSelected) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Grid/graph/graph.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<!-- Iterate through joints,links,compoundlinks, and forces and display them in the template. Draw links then joints-->
<ng-container *ngFor="let trajectory of getTrajectories()">
<svg:g app-trajectory [trajectory]="trajectory.coords"></svg:g>
<svg:g app-trajectory [trajectory]="trajectory.coords" [joint]="getOneJoint(trajectory.id)" ] ></svg:g>
</ng-container>

<ng-container *ngFor="let link of getLinks()">
Expand Down
9 changes: 9 additions & 0 deletions src/app/components/Grid/graph/graph.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ export class GraphComponent {
return Array.from(this.stateService.getMechanism().getTrajectories());
}

public getOneJoint(id: number): Joint | null {
for (const joint of this.stateService.getMechanism().getJoints()) {
if (joint.id === id) {
return joint;
}
}
return null;
}

public getLinks(): Link[] {
return Array.from(this.stateService.getMechanism().getIndependentLinks());
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Grid/joint/joint.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@

.weld-icon{
padding: 3px;
filter: invert(100%) sepia(100%) saturate(1%) hue-rotate(343deg) brightness(102%) contrast(101%);
filter: sepia(100%) saturate(1%) hue-rotate(343deg) brightness(102%) contrast(101%);
}
71 changes: 40 additions & 31 deletions src/app/components/Grid/joint/joint.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,45 +52,54 @@
/>
}


@if(isWelded()){
<image xlink:href='../../../assets/icons/weld.svg' class="weld-icon"
[attr.x]="getX()-getRadius()*2+12"
[attr.y]="getY()-getRadius()*2+12"
[attr.height]="getRadius()*2"
/>

<!-- OLD WELD, MEANT TO BE NEW TRACER ICON- TODO PUT INTO ADD TRACER FUNCTIONALITY
<path
d='M -5.5 -5.5 H-16.5 V4.5 H-5.5 V15.5 H4.5 V4.5 H15.5 V-5.5 H4.5 V-16.5 H-5.5 V-5.5 Z'
[attr.fill]="getColor()"
stroke="#FFCA26"
[attr.stroke-width]="getStrokeWidth()"
[attr.transform]="getTranslation()"
></path>
-->


}
@if (isRef() && !this.joint.isHidden){
@if (isRef() && !this.joint.isHidden && !this.joint.isTracer){
<!-- Need more elegant way to do this WITHOUT using <image> -->
<svg width="65" height="65" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"
[attr.x]="getX()-23"
[attr.y]="getY()-22">
<!-- This centers it where the joints would regularly be, I don't know why -->
<path d="M7.07 0V14M0 6.79H14M11.62 6.72C11.62 9.27156 9.55156 11.34 7 11.34C4.44844 11.34 2.38 9.27156 2.38 6.72C2.38 4.16844 4.44844 2.1 7 2.1C9.55156 2.1 11.62 4.16844 11.62 6.72Z" stroke="black"/>
</svg>
} @else if (this.joint.isTracer && !this.joint.isGrounded) {
<svg:circle
[attr.cx]="getX()"
[attr.cy]="getY()"
[attr.r]="getRadius()"
[attr.fill]="getColor()"
stroke="#000000"
[attr.stroke-width]="3"
stroke-dasharray="9.4247 9.4247"
/>
} @else {
<svg:circle
[attr.cx]="getX()"
[attr.cy]="getY()"
[attr.r]="getRadius()"
[attr.fill]="getColor()"
stroke="#FFCA26"
[attr.stroke-width]="getStrokeWidth()"
/>
}

@if(isWelded()){
<image xlink:href='../../../assets/icons/weld.svg' class="weld-icon"
[attr.x]="getX()-getRadius()*2+14"
[attr.y]="getY()-getRadius()*2+18"
[attr.height]="getRadius()*2.1"
/>

<!-- OLD WELD, MEANT TO BE NEW TRACER ICON- TODO PUT INTO ADD TRACER FUNCTIONALITY
<path
d='M -5.5 -5.5 H-16.5 V4.5 H-5.5 V15.5 H4.5 V4.5 H15.5 V-5.5 H4.5 V-16.5 H-5.5 V-5.5 Z'
[attr.fill]="getColor()"
stroke="#FFCA26"
[attr.stroke-width]="getStrokeWidth()"
[attr.transform]="getTranslation()"
></path>
-->


}
@else {
<svg:circle
[attr.cx]="getX()"
[attr.cy]="getY()"
[attr.r]="getRadius()"
[attr.fill]="getColor()"
stroke="#FFCA26"
[attr.stroke-width]="getStrokeWidth()"
/>
}

@if(isHovered() || isSelected() || showIDLabels) {
<!-- Joint name -->
Expand Down
31 changes: 30 additions & 1 deletion src/app/components/Grid/link/link.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,36 @@ export class LinkComponent
coord = this.unitConversionService.modelCoordToSVGCoord(coord);
allCoords.push(coord);
}
return this.svgPathService.getSingleLinkDrawnPath(allCoords, radius);
if (this.link.isCircle) {
let pathStr = '';
let i: number = 0;
let foundInput: boolean = false;
let inputCoords: Coord;
for (const [jID, currentJ] of this.link.joints) {
if (!foundInput && currentJ.isGrounded) {
inputCoords = this.unitConversionService.modelCoordToSVGCoord(currentJ.coords);
pathStr = this.svgPathService.getCircularLink(inputCoords, this.farthestPoint(currentJ.coords), 18 + 10);
foundInput = true;
}
}

return pathStr;

} else {
return this.svgPathService.getSingleLinkDrawnPath(allCoords, radius);
}

}

farthestPoint(center: Coord): number {
let radius: number = 0;
for (const [jID, currentJ] of this.link.joints) {
const currentR = center.getDistanceTo(currentJ.coords);
if (currentR > radius) {
radius = currentR;
}
}
return radius;
}

getLengthSVG() {
Expand Down
21 changes: 19 additions & 2 deletions src/app/components/Grid/trajectory/trajectory.component.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
<svg:g >
<!-- Draw the trajectory path -->
<path
@if (!this.joint?.isHidden && this.joint?.isTracer){
<path
[attr.d]="getPath()"
[attr.stroke]="getStrokeColor()"
stroke-width="2"
fill="none"
[attr.stroke-width]="3"
stroke-dasharray="9.4247 9.4247"
></path>
} @else {
<path
[attr.d]="getPath()"
[attr.stroke]="getStrokeColor()"
stroke-width="2"
fill="none"
></path>
}
<!--<path
[attr.d]="getPath()"
[attr.stroke]="getStrokeColor()"
stroke-width="2"
fill="none"
></path>
></path>-->

</svg:g>

2 changes: 2 additions & 0 deletions src/app/components/Grid/trajectory/trajectory.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component, Input } from '@angular/core';
import { Coord } from 'src/app/model/coord';
import { SVGPathService } from 'src/app/services/svg-path.service';
import { UnitConversionService } from 'src/app/services/unit-conversion.service';
import {Joint} from "../../../model/joint";

@Component({
selector: '[app-trajectory]',
Expand All @@ -11,6 +12,7 @@ import { UnitConversionService } from 'src/app/services/unit-conversion.service'

export class TrajectoryComponent {
@Input() trajectory!: Coord[];
@Input() joint!: Joint | null;

constructor(
private svgPathService: SVGPathService,
Expand Down
19 changes: 19 additions & 0 deletions src/app/components/ToolBar/undo-redo-panel/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ export interface Action {
linkTracerData?: LinkTracerSnapshot;
linkForceData?: LinkForceSnapshot;

compoundLinkData?: CompoundLinkSnapshot;
compoundLinkDataArray?: CompoundLinkSnapshot[];
compoundExtraLinkData?: LinkSnapshot[];
compoundExtraJointsData?: JointSnapshot[][];

oldJointPositions?: Array<{
jointId: number;
coords: { x: number; y: number };
Expand All @@ -49,6 +54,15 @@ export interface Action {
newAngle?: number;
}

export interface CompoundLinkSnapshot {
id: number;
linkIds: number[];
name: string;
mass: number;
locked: boolean;
color: string;
}

export interface LinkSnapshot {
id: number;
jointIds: number[];
Expand All @@ -57,6 +71,7 @@ export interface LinkSnapshot {
angle: number;
locked: boolean;
color: string;
isCircle?: boolean;
}

export interface JointSnapshot {
Expand All @@ -72,6 +87,8 @@ export interface JointSnapshot {
locked: boolean;
isHidden: boolean;
isReference: boolean;
isTracer: boolean;
isPartOfWelded: boolean;
}

export interface LinkLockSnapshot {
Expand All @@ -94,6 +111,8 @@ export interface LinkTracerSnapshot {
linkId: number;
jointId: number;
coords: { x: number; y: number };
tracerModelPos?: Coord;
tracerSVGPos?: Coord;
}

export interface LinkForceSnapshot {
Expand Down
Loading
Loading